profile
viewpoint

danmar/cppcheck 3144

static analysis of C/C++ code

matthiaskrgr/cargo-cache 289

manage cargo cache (${CARGO_HOME}, ~/.cargo/), print sizes of dirs and remove dirs selectively

FLIF-hub/flifcrush 41

simple lossless crusher tries to reduce FLIFs in size by recompressing them with different parameters

karolherbst/Gamekeeper-Framework 2

Library for hooking up game stores and merging them into one single library

matthiaskrgr/cargo-rebuild-check 2

checks installed rust crates for missing library links and can auto-rebuild if necessary

matthiaskrgr/clippy_crashfinder 2

crate to run clippy against all crates in the local cargo cache

I4-Projektseminar-HHU-2016/seminar-project-matthiaskrgr 0

seminar-project-matthiaskrgr created by GitHub Classroom

karolherbst/Gamekeeper-Files 0

Runtime files needed for Gamekeeper

issue commentrust-lang/rust

ICE with "-Z ast-json": Attempted to encode LazyTokenStream

No idea if this is the underlying issue but I found that for example this snippet crashes with -Zast-json

fn main() {}

macro_rules! mac_extern {
    ($i:item) => {
        extern "C" { $i }
    }
}

mac_extern! {
    fn foo();
}
dgrunwald

comment created time in 10 hours

issue openedwidelands/widelands

memory leaks after playing locally with ai

Please fill out the relevant sections below and delete the rest.

I got these memory leaks after playing locally with a couple of bots

Direct leak of 104 byte(s) in 1 object(s) allocated from:
    #0 0x5638d3bd2b39 in operator new(unsigned long) (/home/matthias/vcs/github/widelands/widelands+0x396ab39)
    #1 0x5638d406c4a1 in RT::Tag::parse_content(RT::TextStream&, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, RT::TagConstraint, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, RT::TagConstraint> > >&, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) /home/matthias/vcs/github/widelands/src/graphic/text/rt_parse.cc:156:16
    #2 0x5638d406d2f6 in RT::Tag::parse(RT::TextStream&, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, RT::TagConstraint, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, RT::TagConstraint> > >&, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) /home/matthias/vcs/github/widelands/src/graphic/text/rt_parse.cc:177:3
    #3 0x5638d406c57d in RT::Tag::parse_content(RT::TextStream&, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, RT::TagConstraint, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, RT::TagConstraint> > >&, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) /home/matthias/vcs/github/widelands/src/graphic/text/rt_parse.cc:160:10
    #4 0x5638d406d2f6 in RT::Tag::parse(RT::TextStream&, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, RT::TagConstraint, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, RT::TagConstraint> > >&, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) /home/matthias/vcs/github/widelands/src/graphic/text/rt_parse.cc:177:3
    #5 0x5638d406c57d in RT::Tag::parse_content(RT::TextStream&, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, RT::TagConstraint, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, RT::TagConstraint> > >&, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) /home/matthias/vcs/github/widelands/src/graphic/text/rt_parse.cc:160:10
    #6 0x5638d406d2f6 in RT::Tag::parse(RT::TextStream&, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, RT::TagConstraint, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, RT::TagConstraint> > >&, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) /home/matthias/vcs/github/widelands/src/graphic/text/rt_parse.cc:177:3
    #7 0x5638d406c57d in RT::Tag::parse_content(RT::TextStream&, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, RT::TagConstraint, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, RT::TagConstraint> > >&, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) /home/matthias/vcs/github/widelands/src/graphic/text/rt_parse.cc:160:10
    #8 0x5638d406d2f6 in RT::Tag::parse(RT::TextStream&, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, RT::TagConstraint, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, RT::TagConstraint> > >&, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) /home/matthias/vcs/github/widelands/src/graphic/text/rt_parse.cc:177:3
    #9 0x5638d4070f98 in RT::Parser::parse(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) /home/matthias/vcs/github/widelands/src/graphic/text/rt_parse.cc:524:6
    #10 0x5638d3fdd58e in RT::Renderer::layout(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short, bool, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) /home/matthias/vcs/github/widelands/src/graphic/text/rt_render.cc:1802:35
    #11 0x5638d3fde21b in RT::Renderer::render(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short, bool, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) /home/matthias/vcs/github/widelands/src/graphic/text/rt_render.cc:1837:35
    #12 0x5638d3fa4556 in UI::FontHandler::render(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short) /home/matthias/vcs/github/widelands/src/graphic/font_handler.cc:90:49
    #13 0x5638d44f3177 in UI::MultilineTextarea::recompute() /home/matthias/vcs/github/widelands/src/ui_basic/multilinetextarea.cc:103:32
    #14 0x5638d4605366 in MapDetailsBox::show_map_description(Widelands::Map&, GameSettingsProvider*) /home/matthias/vcs/github/widelands/src/ui_fsmenu/mapdetailsbox.cc:216:2
    #15 0x5638d4604d47 in MapDetailsBox::update(GameSettingsProvider*, Widelands::Map&) /home/matthias/vcs/github/widelands/src/ui_fsmenu/mapdetailsbox.cc:204:2
    #16 0x5638d45ec5ef in FullscreenMenuLaunchSPG::update() /home/matthias/vcs/github/widelands/src/ui_fsmenu/launch_spg.cc:113:15
    #17 0x5638d45edbd7 in FullscreenMenuLaunchSPG::clicked_select_map() /home/matthias/vcs/github/widelands/src/ui_fsmenu/launch_spg.cc:91:2
    #18 0x5638d45ed10c in FullscreenMenuLaunchSPG::start() /home/matthias/vcs/github/widelands/src/ui_fsmenu/launch_spg.cc:57:26
    #19 0x5638d44faee0 in UI::Panel::do_run() /home/matthias/vcs/github/widelands/src/ui_basic/panel.cc:170:2
    #20 0x5638d3bed8d1 in WLApplication::new_game(Widelands::Game&, SinglePlayerGameSettingsProvider&, bool, bool*) /home/matthias/vcs/github/widelands/src/wlapplication.cc:1450:13
    #21 0x5638d3be33ea in WLApplication::mainmenu() /home/matthias/vcs/github/widelands/src/wlapplication.cc:1199:5
    #22 0x5638d3be0afa in WLApplication::run() /home/matthias/vcs/github/widelands/src/wlapplication.cc:502:3
    #23 0x5638d3bd59e7 in main /home/matthias/vcs/github/widelands/src/main.cc:42:10
    #24 0x7fce78a2f151 in __libc_start_main (/usr/lib/libc.so.6+0x28151)

Direct leak of 104 byte(s) in 1 object(s) allocated from:
    #0 0x5638d3bd2b39 in operator new(unsigned long) (/home/matthias/vcs/github/widelands/widelands+0x396ab39)
    #1 0x5638d4070f0c in RT::Parser::parse(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) /home/matthias/vcs/github/widelands/src/graphic/text/rt_parse.cc:523:12
    #2 0x5638d3fdd58e in RT::Renderer::layout(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short, bool, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) /home/matthias/vcs/github/widelands/src/graphic/text/rt_render.cc:1802:35
    #3 0x5638d3fde21b in RT::Renderer::render(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short, bool, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) /home/matthias/vcs/github/widelands/src/graphic/text/rt_render.cc:1837:35
    #4 0x5638d3fa4556 in UI::FontHandler::render(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short) /home/matthias/vcs/github/widelands/src/graphic/font_handler.cc:90:49
    #5 0x5638d44f3177 in UI::MultilineTextarea::recompute() /home/matthias/vcs/github/widelands/src/ui_basic/multilinetextarea.cc:103:32
    #6 0x5638d4605366 in MapDetailsBox::show_map_description(Widelands::Map&, GameSettingsProvider*) /home/matthias/vcs/github/widelands/src/ui_fsmenu/mapdetailsbox.cc:216:2
    #7 0x5638d4604d47 in MapDetailsBox::update(GameSettingsProvider*, Widelands::Map&) /home/matthias/vcs/github/widelands/src/ui_fsmenu/mapdetailsbox.cc:204:2
    #8 0x5638d45ec5ef in FullscreenMenuLaunchSPG::update() /home/matthias/vcs/github/widelands/src/ui_fsmenu/launch_spg.cc:113:15
    #9 0x5638d45edbd7 in FullscreenMenuLaunchSPG::clicked_select_map() /home/matthias/vcs/github/widelands/src/ui_fsmenu/launch_spg.cc:91:2
    #10 0x5638d45ed10c in FullscreenMenuLaunchSPG::start() /home/matthias/vcs/github/widelands/src/ui_fsmenu/launch_spg.cc:57:26
    #11 0x5638d44faee0 in UI::Panel::do_run() /home/matthias/vcs/github/widelands/src/ui_basic/panel.cc:170:2
    #12 0x5638d3bed8d1 in WLApplication::new_game(Widelands::Game&, SinglePlayerGameSettingsProvider&, bool, bool*) /home/matthias/vcs/github/widelands/src/wlapplication.cc:1450:13
    #13 0x5638d3be33ea in WLApplication::mainmenu() /home/matthias/vcs/github/widelands/src/wlapplication.cc:1199:5
    #14 0x5638d3be0afa in WLApplication::run() /home/matthias/vcs/github/widelands/src/wlapplication.cc:502:3
    #15 0x5638d3bd59e7 in main /home/matthias/vcs/github/widelands/src/main.cc:42:10
    #16 0x7fce78a2f151 in __libc_start_main (/usr/lib/libc.so.6+0x28151)

Direct leak of 104 byte(s) in 1 object(s) allocated from:
    #0 0x5638d3bd2b39 in operator new(unsigned long) (/home/matthias/vcs/github/widelands/widelands+0x396ab39)
    #1 0x5638d406c4a1 in RT::Tag::parse_content(RT::TextStream&, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, RT::TagConstraint, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, RT::TagConstraint> > >&, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) /home/matthias/vcs/github/widelands/src/graphic/text/rt_parse.cc:156:16
    #2 0x5638d406d2f6 in RT::Tag::parse(RT::TextStream&, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, RT::TagConstraint, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, RT::TagConstraint> > >&, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) /home/matthias/vcs/github/widelands/src/graphic/text/rt_parse.cc:177:3
    #3 0x5638d4070f98 in RT::Parser::parse(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) /home/matthias/vcs/github/widelands/src/graphic/text/rt_parse.cc:524:6
    #4 0x5638d3fdd58e in RT::Renderer::layout(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short, bool, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) /home/matthias/vcs/github/widelands/src/graphic/text/rt_render.cc:1802:35
    #5 0x5638d3fde21b in RT::Renderer::render(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short, bool, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) /home/matthias/vcs/github/widelands/src/graphic/text/rt_render.cc:1837:35
    #6 0x5638d3fa4556 in UI::FontHandler::render(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short) /home/matthias/vcs/github/widelands/src/graphic/font_handler.cc:90:49
    #7 0x5638d44f3177 in UI::MultilineTextarea::recompute() /home/matthias/vcs/github/widelands/src/ui_basic/multilinetextarea.cc:103:32
    #8 0x5638d4605366 in MapDetailsBox::show_map_description(Widelands::Map&, GameSettingsProvider*) /home/matthias/vcs/github/widelands/src/ui_fsmenu/mapdetailsbox.cc:216:2
    #9 0x5638d4604d47 in MapDetailsBox::update(GameSettingsProvider*, Widelands::Map&) /home/matthias/vcs/github/widelands/src/ui_fsmenu/mapdetailsbox.cc:204:2
    #10 0x5638d45ec5ef in FullscreenMenuLaunchSPG::update() /home/matthias/vcs/github/widelands/src/ui_fsmenu/launch_spg.cc:113:15
    #11 0x5638d45edbd7 in FullscreenMenuLaunchSPG::clicked_select_map() /home/matthias/vcs/github/widelands/src/ui_fsmenu/launch_spg.cc:91:2
    #12 0x5638d45ed10c in FullscreenMenuLaunchSPG::start() /home/matthias/vcs/github/widelands/src/ui_fsmenu/launch_spg.cc:57:26
    #13 0x5638d44faee0 in UI::Panel::do_run() /home/matthias/vcs/github/widelands/src/ui_basic/panel.cc:170:2
    #14 0x5638d3bed8d1 in WLApplication::new_game(Widelands::Game&, SinglePlayerGameSettingsProvider&, bool, bool*) /home/matthias/vcs/github/widelands/src/wlapplication.cc:1450:13
    #15 0x5638d3be33ea in WLApplication::mainmenu() /home/matthias/vcs/github/widelands/src/wlapplication.cc:1199:5
    #16 0x5638d3be0afa in WLApplication::run() /home/matthias/vcs/github/widelands/src/wlapplication.cc:502:3
    #17 0x5638d3bd59e7 in main /home/matthias/vcs/github/widelands/src/main.cc:42:10
    #18 0x7fce78a2f151 in __libc_start_main (/usr/lib/libc.so.6+0x28151)

(I just let the game run for a couple of minutes without building anything)

game @ dadeaecaa874e9750a2cfb73fcd5ccdd95326915

created time in 3 days

issue openedwidelands/widelands

ub when starting match with ai: store to misaligned address

Please fill out the relevant sections below and delete the rest.

Describe the bug When I start game against the default AI I get these UBSAN warnings build with -fsanitize=undefined and launch UBSAN_OPTIONS=print_stacktrace=1 ./widelands for backtraces:

/home/matthias/vcs/github/widelands/src/base/md5.cc:81:2: runtime error: store to misaligned address 0x7ffc89449a09 for type 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment
0x7ffc89449a09: note: pointer points here
 56 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 e2 76 17 c1 7b 1a 19  ab 2d 8a 5f 4d
              ^
    #0 0x563c17cc63dc in md5_finish_ctx(Md5Ctx*, void*) /home/matthias/vcs/github/widelands/src/base/md5.cc:81:36
    #1 0x563c1659e891 in Widelands::Game::get_sync_hash() const /home/matthias/vcs/github/widelands/src/logic/game.cc:700:7
    #2 0x563c16675dac in Widelands::CmdReplaySyncWrite::execute(Widelands::Game&) /home/matthias/vcs/github/widelands/src/logic/replay.cc:208:23
    #3 0x563c1779427f in Widelands::CmdQueue::run_queue(Duration const&, Time&) /home/matthias/vcs/github/widelands/src/logic/cmd_queue.cc:122:6
    #4 0x563c1659c67e in Widelands::Game::think() /home/matthias/vcs/github/widelands/src/logic/game.cc:605:14
    #5 0x563c16c13112 in InteractiveBase::think() /home/matthias/vcs/github/widelands/src/wui/interactive_base.cc:731:11
    #6 0x563c16cc4ee5 in InteractivePlayer::think() /home/matthias/vcs/github/widelands/src/wui/interactive_player.cc:401:19
    #7 0x563c169a2c5a in UI::Panel::do_think() /home/matthias/vcs/github/widelands/src/ui_basic/panel.cc:534:3
    #8 0x563c169a11e1 in UI::Panel::do_run() /home/matthias/vcs/github/widelands/src/ui_basic/panel.cc:195:4
    #9 0x563c1659688c in Widelands::Game::run(Widelands::Game::StartGameType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/matthias/vcs/github/widelands/src/logic/game.cc:575:15
    #10 0x563c160945cc in WLApplication::new_game(Widelands::Game&, SinglePlayerGameSettingsProvider&, bool, bool*) /home/matthias/vcs/github/widelands/src/wlapplication.cc:1488:9
    #11 0x563c160893ea in WLApplication::mainmenu() /home/matthias/vcs/github/widelands/src/wlapplication.cc:1199:5
    #12 0x563c16086afa in WLApplication::run() /home/matthias/vcs/github/widelands/src/wlapplication.cc:502:3
    #13 0x563c1607b9e7 in main /home/matthias/vcs/github/widelands/src/main.cc:42:10
    #14 0x7f1649cdb151 in __libc_start_main (/usr/lib/libc.so.6+0x28151)
    #15 0x563c15fa020d in _start (/home/matthias/vcs/github/widelands/widelands+0x389220d)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/matthias/vcs/github/widelands/src/base/md5.cc:81:2 in
/home/matthias/vcs/github/widelands/src/base/md5.cc:82:2: runtime error: store to misaligned address 0x7ffc89449a0d for type 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment
0x7ffc89449a0d: note: pointer points here
 c1 7b 1a 19 00 00 00  00 00 00 00 00 00 00 00  00 e2 76 17 c1 7b 1a 19  ab 2d 8a 5f 4d 5b eb 38  dd
             ^
    #0 0x563c17cc62f4 in md5_finish_ctx(Md5Ctx*, void*) /home/matthias/vcs/github/widelands/src/base/md5.cc:82:36
    #1 0x563c1659e891 in Widelands::Game::get_sync_hash() const /home/matthias/vcs/github/widelands/src/logic/game.cc:700:7
    #2 0x563c16675dac in Widelands::CmdReplaySyncWrite::execute(Widelands::Game&) /home/matthias/vcs/github/widelands/src/logic/replay.cc:208:23
    #3 0x563c1779427f in Widelands::CmdQueue::run_queue(Duration const&, Time&) /home/matthias/vcs/github/widelands/src/logic/cmd_queue.cc:122:6
    #4 0x563c1659c67e in Widelands::Game::think() /home/matthias/vcs/github/widelands/src/logic/game.cc:605:14
    #5 0x563c16c13112 in InteractiveBase::think() /home/matthias/vcs/github/widelands/src/wui/interactive_base.cc:731:11
    #6 0x563c16cc4ee5 in InteractivePlayer::think() /home/matthias/vcs/github/widelands/src/wui/interactive_player.cc:401:19
    #7 0x563c169a2c5a in UI::Panel::do_think() /home/matthias/vcs/github/widelands/src/ui_basic/panel.cc:534:3
    #8 0x563c169a11e1 in UI::Panel::do_run() /home/matthias/vcs/github/widelands/src/ui_basic/panel.cc:195:4
    #9 0x563c1659688c in Widelands::Game::run(Widelands::Game::StartGameType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/matthias/vcs/github/widelands/src/logic/game.cc:575:15
    #10 0x563c160945cc in WLApplication::new_game(Widelands::Game&, SinglePlayerGameSettingsProvider&, bool, bool*) /home/matthias/vcs/github/widelands/src/wlapplication.cc:1488:9
    #11 0x563c160893ea in WLApplication::mainmenu() /home/matthias/vcs/github/widelands/src/wlapplication.cc:1199:5
    #12 0x563c16086afa in WLApplication::run() /home/matthias/vcs/github/widelands/src/wlapplication.cc:502:3
    #13 0x563c1607b9e7 in main /home/matthias/vcs/github/widelands/src/main.cc:42:10
    #14 0x7f1649cdb151 in __libc_start_main (/usr/lib/libc.so.6+0x28151)
    #15 0x563c15fa020d in _start (/home/matthias/vcs/github/widelands/widelands+0x389220d)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/matthias/vcs/github/widelands/src/base/md5.cc:82:2 in
/home/matthias/vcs/github/widelands/src/base/md5.cc:83:2: runtime error: store to misaligned address 0x7ffc89449a11 for type 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment
0x7ffc89449a11: note: pointer points here
 ab 2d 8a  5f 00 00 00 00 00 00 00  00 e2 76 17 c1 7b 1a 19  ab 2d 8a 5f 4d 5b eb 38  dd fd 7c 63 9d
              ^
    #0 0x563c17cc6357 in md5_finish_ctx(Md5Ctx*, void*) /home/matthias/vcs/github/widelands/src/base/md5.cc:83:36
    #1 0x563c1659e891 in Widelands::Game::get_sync_hash() const /home/matthias/vcs/github/widelands/src/logic/game.cc:700:7
    #2 0x563c16675dac in Widelands::CmdReplaySyncWrite::execute(Widelands::Game&) /home/matthias/vcs/github/widelands/src/logic/replay.cc:208:23
    #3 0x563c1779427f in Widelands::CmdQueue::run_queue(Duration const&, Time&) /home/matthias/vcs/github/widelands/src/logic/cmd_queue.cc:122:6
    #4 0x563c1659c67e in Widelands::Game::think() /home/matthias/vcs/github/widelands/src/logic/game.cc:605:14
    #5 0x563c16c13112 in InteractiveBase::think() /home/matthias/vcs/github/widelands/src/wui/interactive_base.cc:731:11
    #6 0x563c16cc4ee5 in InteractivePlayer::think() /home/matthias/vcs/github/widelands/src/wui/interactive_player.cc:401:19
    #7 0x563c169a2c5a in UI::Panel::do_think() /home/matthias/vcs/github/widelands/src/ui_basic/panel.cc:534:3
    #8 0x563c169a11e1 in UI::Panel::do_run() /home/matthias/vcs/github/widelands/src/ui_basic/panel.cc:195:4
    #9 0x563c1659688c in Widelands::Game::run(Widelands::Game::StartGameType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/matthias/vcs/github/widelands/src/logic/game.cc:575:15
    #10 0x563c160945cc in WLApplication::new_game(Widelands::Game&, SinglePlayerGameSettingsProvider&, bool, bool*) /home/matthias/vcs/github/widelands/src/wlapplication.cc:1488:9
    #11 0x563c160893ea in WLApplication::mainmenu() /home/matthias/vcs/github/widelands/src/wlapplication.cc:1199:5
    #12 0x563c16086afa in WLApplication::run() /home/matthias/vcs/github/widelands/src/wlapplication.cc:502:3
    #13 0x563c1607b9e7 in main /home/matthias/vcs/github/widelands/src/main.cc:42:10
    #14 0x7f1649cdb151 in __libc_start_main (/usr/lib/libc.so.6+0x28151)
    #15 0x563c15fa020d in _start (/home/matthias/vcs/github/widelands/widelands+0x389220d)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/matthias/vcs/github/widelands/src/base/md5.cc:83:2 in
/home/matthias/vcs/github/widelands/src/base/md5.cc:84:2: runtime error: store to misaligned address 0x7ffc89449a15 for type 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment
0x7ffc89449a15: note: pointer points here
 4d 5b eb 38 00 00 00  00 e2 76 17 c1 7b 1a 19  ab 2d 8a 5f 4d 5b eb 38  dd fd 7c 63 9d 4e 00 00  00
             ^
    #0 0x563c17cc63b1 in md5_finish_ctx(Md5Ctx*, void*) /home/matthias/vcs/github/widelands/src/base/md5.cc:84:36
    #1 0x563c1659e891 in Widelands::Game::get_sync_hash() const /home/matthias/vcs/github/widelands/src/logic/game.cc:700:7
    #2 0x563c16675dac in Widelands::CmdReplaySyncWrite::execute(Widelands::Game&) /home/matthias/vcs/github/widelands/src/logic/replay.cc:208:23
    #3 0x563c1779427f in Widelands::CmdQueue::run_queue(Duration const&, Time&) /home/matthias/vcs/github/widelands/src/logic/cmd_queue.cc:122:6
    #4 0x563c1659c67e in Widelands::Game::think() /home/matthias/vcs/github/widelands/src/logic/game.cc:605:14
    #5 0x563c16c13112 in InteractiveBase::think() /home/matthias/vcs/github/widelands/src/wui/interactive_base.cc:731:11
    #6 0x563c16cc4ee5 in InteractivePlayer::think() /home/matthias/vcs/github/widelands/src/wui/interactive_player.cc:401:19
    #7 0x563c169a2c5a in UI::Panel::do_think() /home/matthias/vcs/github/widelands/src/ui_basic/panel.cc:534:3
    #8 0x563c169a11e1 in UI::Panel::do_run() /home/matthias/vcs/github/widelands/src/ui_basic/panel.cc:195:4
    #9 0x563c1659688c in Widelands::Game::run(Widelands::Game::StartGameType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/matthias/vcs/github/widelands/src/logic/game.cc:575:15
    #10 0x563c160945cc in WLApplication::new_game(Widelands::Game&, SinglePlayerGameSettingsProvider&, bool, bool*) /home/matthias/vcs/github/widelands/src/wlapplication.cc:1488:9
    #11 0x563c160893ea in WLApplication::mainmenu() /home/matthias/vcs/github/widelands/src/wlapplication.cc:1199:5
    #12 0x563c16086afa in WLApplication::run() /home/matthias/vcs/github/widelands/src/wlapplication.cc:502:3
    #13 0x563c1607b9e7 in main /home/matthias/vcs/github/widelands/src/main.cc:42:10
    #14 0x7f1649cdb151 in __libc_start_main (/usr/lib/libc.so.6+0x28151)
    #15 0x563c15fa020d in _start (/home/matthias/vcs/github/widelands/widelands+0x389220d)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/matthias/vcs/github/widelands/src/base/md5.cc:84:2 in
/home/matthias/vcs/github/widelands/src/logic/map_objects/bob.cc:909:3: runtime error: store to misaligned address 0x7f160fc4e522 for type 'Widelands::Bob *', which requires 8 byte alignment
0x7f160fc4e522: note: pointer points here
 01 00  01 00 00 35 15 00 10 61  00 00 00 00 00 00 00 00  00 00 24 24 00 00 00 00  00 00 00 00 00 00
              ^
    #0 0x563c16fbaae7 in Widelands::Bob::set_position(Widelands::EditorGameBase&, Widelands::Coords const&) /home/matthias/vcs/github/widelands/src/logic/map_objects/bob.cc:909:15
    #1 0x563c16fc6704 in Widelands::Bob::start_walk(Widelands::Game&, Widelands::WalkingDir, unsigned int, bool) /home/matthias/vcs/github/widelands/src/logic/map_objects/bob.cc:861:2
    #2 0x563c16fc5693 in Widelands::Bob::start_task_move(Widelands::Game&, int, DirAnimations const&, bool) /home/matthias/vcs/github/widelands/src/logic/map_objects/bob.cc:696:5
    #3 0x563c16fc2154 in Widelands::Bob::movepath_update(Widelands::Game&, Widelands::Bob::State&) /home/matthias/vcs/github/widelands/src/logic/map_objects/bob.cc:677:9
    #4 0x563c16fbdd7d in Widelands::Bob::do_act(Widelands::Game&) /home/matthias/vcs/github/widelands/src/logic/map_objects/bob.cc:194:2
    #5 0x563c1779427f in Widelands::CmdQueue::run_queue(Duration const&, Time&) /home/matthias/vcs/github/widelands/src/logic/cmd_queue.cc:122:6
    #6 0x563c1659c67e in Widelands::Game::think() /home/matthias/vcs/github/widelands/src/logic/game.cc:605:14
    #7 0x563c16c13112 in InteractiveBase::think() /home/matthias/vcs/github/widelands/src/wui/interactive_base.cc:731:11
    #8 0x563c16cc4ee5 in InteractivePlayer::think() /home/matthias/vcs/github/widelands/src/wui/interactive_player.cc:401:19
    #9 0x563c169a2c5a in UI::Panel::do_think() /home/matthias/vcs/github/widelands/src/ui_basic/panel.cc:534:3
    #10 0x563c169a11e1 in UI::Panel::do_run() /home/matthias/vcs/github/widelands/src/ui_basic/panel.cc:195:4
    #11 0x563c1659688c in Widelands::Game::run(Widelands::Game::StartGameType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/matthias/vcs/github/widelands/src/logic/game.cc:575:15
    #12 0x563c160945cc in WLApplication::new_game(Widelands::Game&, SinglePlayerGameSettingsProvider&, bool, bool*) /home/matthias/vcs/github/widelands/src/wlapplication.cc:1488:9
    #13 0x563c160893ea in WLApplication::mainmenu() /home/matthias/vcs/github/widelands/src/wlapplication.cc:1199:5
    #14 0x563c16086afa in WLApplication::run() /home/matthias/vcs/github/widelands/src/wlapplication.cc:502:3
    #15 0x563c1607b9e7 in main /home/matthias/vcs/github/widelands/src/main.cc:42:10
    #16 0x7f1649cdb151 in __libc_start_main (/usr/lib/libc.so.6+0x28151)
    #17 0x563c15fa020d in _start (/home/matthias/vcs/github/widelands/widelands+0x389220d)

game @ dadeaecaa874e9750a2cfb73fcd5ccdd95326915

created time in 3 days

issue openedwidelands/widelands

UB in map generator

Please fill out the relevant sections below and delete the rest.

Describe the bug There seems to be some runtime errors in the map generator

To Reproduce Steps to reproduce the behavior: Build with -fsanitize=undefined and generate a map:

/home/matthias/vcs/github/widelands/src/editor/map_generator.cc:312:31: runtime error: -8.48332e+07 is outside the range of representable values of type 'unsigned int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/matthias/vcs/github/widelands/src/editor/map_generator.cc:312:31 in
/home/matthias/vcs/github/widelands/src/editor/map_generator.cc:316:31: runtime error: -3.15452e+07 is outside the range of representable values of type 'unsigned int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/matthias/vcs/github/widelands/src/editor/map_generator.cc:316:31 in
/home/matthias/vcs/github/widelands/src/editor/map_generator.cc:320:31: runtime error: -1.85063e+08 is outside the range of representable values of type 'unsigned int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/matthias/vcs/github/widelands/src/editor/map_generator.cc:320:31 in
/home/matthias/vcs/github/widelands/src/editor/map_generator.cc:376:8: runtime error: 4.31791e+09 is outside the range of representable values of type 'unsigned int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/matthias/vcs/github/widelands/src/editor/map_generator.cc:376:8 in
/home/matthias/vcs/github/widelands/src/logic/map_objects/bob.cc:922:2: runtime error: store to misaligned address 0x7f50597ee62c for type 'Widelands::Bob *', which requires 8 byte alignment
0x7f50597ee62c: note: pointer points here
  12 00 23 00 00 00 00 00  00 00 00 00 40 d0 2f 00  00 61 00 00 20 24 00 00  00 00 00 00 00 00 00 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/matthias/vcs/github/widelands/src/logic/map_objects/bob.cc:922:2 in

game @ dadeaecaa874e9750a2cfb73fcd5ccdd95326915

created time in 3 days

issue commentrust-lang/rust

ICE With Minimal safer_ffi Example: Expected module, found DefId(18:190)

duplicate of https://github.com/rust-lang/rust/issues/75982 I guess?

zicklag

comment created time in 4 days

issue openedrust-lang/rust

ICE: const-generics-demangling.rs

<!-- Thank you for finding an Internal Compiler Error! 🧊 If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples.

http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/

--> reduced from ./src/test/ui/symbol-names/const-generics-demangling.rs

Code

#![feature(min_const_generics, rustc_attrs)]

pub struct Unsigned<const F: u8>;

#[rustc_symbol_name]
impl Unsigned<11> {}

fn main() {}

Meta

<!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. -->

rustc --version --verbose:

rustc 1.49.0-nightly (1eaadebb3 2020-10-21)
binary: rustc
commit-hash: 1eaadebb3dee31669c7649b32747381d11614fae
commit-date: 2020-10-21
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly
LLVM version: 11.0

Error output

error: internal compiler error: compiler/rustc_symbol_mangling/src/legacy.rs:41:21: finding type for DefId(0:6 ~ const_generics_demangling[317d]::{impl#0}), encountered def-id DefId(0:0 ~ const_generics_demangling[317d]) with no parent

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:945:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.49.0-nightly (1eaadebb3 2020-10-21) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [symbol_name] computing the symbol for `Unsigned::<11_u8>`
end of query stack
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
  left: `LLVMing`,
 right: `Codegenning`', /rustc/1eaadebb3dee31669c7649b32747381d11614fae/compiler/rustc_codegen_ssa/src/back/write.rs:1423:21

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.49.0-nightly (1eaadebb3 2020-10-21) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
error: aborting due to previous error

<!-- Include a backtrace in the code block by setting RUST_BACKTRACE=1 in your environment. E.g. RUST_BACKTRACE=1 cargo build. --> <details><summary><strong>Backtrace</strong></summary> <p>

error: internal compiler error: compiler/rustc_symbol_mangling/src/legacy.rs:41:21: finding type for DefId(0:6 ~ const_generics_demangling[317d]::{impl#0}), encountered def-id DefId(0:0 ~ const_generics_demangling[317d]) with no parent

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:945:9
stack backtrace:
   0:     0x7f3c7942da10 - std::backtrace_rs::backtrace::libunwind::trace::h622bab51c72c4e69
                               at /rustc/1eaadebb3dee31669c7649b32747381d11614fae/library/std/src/../../backtrace/src/backtrace/libunwind.rs:100:5
   1:     0x7f3c7942da10 - std::backtrace_rs::backtrace::trace_unsynchronized::h7e820b882ebd41ee
                               at /rustc/1eaadebb3dee31669c7649b32747381d11614fae/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f3c7942da10 - std::sys_common::backtrace::_print_fmt::h64d46258114db92f
                               at /rustc/1eaadebb3dee31669c7649b32747381d11614fae/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f3c7942da10 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h47111d0c1b5f0da5
                               at /rustc/1eaadebb3dee31669c7649b32747381d11614fae/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7f3c7949c94c - core::fmt::write::h1857a60b204f1b6a
                               at /rustc/1eaadebb3dee31669c7649b32747381d11614fae/library/core/src/fmt/mod.rs:1076:17
   5:     0x7f3c7941f632 - std::io::Write::write_fmt::h4604516fed3e5731
                               at /rustc/1eaadebb3dee31669c7649b32747381d11614fae/library/std/src/io/mod.rs:1516:15
   6:     0x7f3c794329c5 - std::sys_common::backtrace::_print::h785e7a78d5ef272c
                               at /rustc/1eaadebb3dee31669c7649b32747381d11614fae/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f3c794329c5 - std::sys_common::backtrace::print::h108047ac5c4555d5
                               at /rustc/1eaadebb3dee31669c7649b32747381d11614fae/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f3c794329c5 - std::panicking::default_hook::{{closure}}::h1d0c271f0d087ebf
                               at /rustc/1eaadebb3dee31669c7649b32747381d11614fae/library/std/src/panicking.rs:208:50
   9:     0x7f3c79432668 - std::panicking::default_hook::h692753e26f11b7b7
                               at /rustc/1eaadebb3dee31669c7649b32747381d11614fae/library/std/src/panicking.rs:227:9
  10:     0x7f3c7a638898 - rustc_driver::report_ice::h027627aaa525f0b3
  11:     0x7f3c79433206 - std::panicking::rust_panic_with_hook::h74ddc20305301cd9
                               at /rustc/1eaadebb3dee31669c7649b32747381d11614fae/library/std/src/panicking.rs:581:17
  12:     0x7f3c7d5c76dd - std::panicking::begin_panic::{{closure}}::hde64e7753bb51667
  13:     0x7f3c7d5c7606 - std::sys_common::backtrace::__rust_end_short_backtrace::h6567ed4099b888c3
  14:     0x7f3c7d5c764f - std::panicking::begin_panic::h5911b197bf270d50
  15:     0x7f3c7d5fe040 - rustc_errors::HandlerInner::bug::hbb6554bd4fbc8852
  16:     0x7f3c7d5fcb20 - rustc_errors::Handler::bug::h4feefeec7bb726ca
  17:     0x7f3c7d070af4 - rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}::h22b92ed7b73b8340
  18:     0x7f3c7d069acb - rustc_middle::ty::context::tls::with_opt::{{closure}}::h32bfd9cf0b0a9393
  19:     0x7f3c7d069a72 - rustc_middle::ty::context::tls::with_opt::h762464f893de2d96
  20:     0x7f3c7d070a19 - rustc_middle::util::bug::opt_span_bug_fmt::h05648c19bbf99518
  21:     0x7f3c7d07098e - rustc_middle::util::bug::bug_fmt::h5d4f7ed12a8f1d0d
  22:     0x7f3c7c12cdd2 - rustc_symbol_mangling::legacy::mangle::{{closure}}::he550c574e35a9647
  23:     0x7f3c7c12ccb2 - rustc_symbol_mangling::legacy::mangle::h2fb1aa82ca83118f
  24:     0x7f3c7c10eac8 - rustc_symbol_mangling::symbol_name_provider::hb4cbbd663d6a8032
  25:     0x7f3c7c144284 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::symbol_name>::compute::h790eea479c51a441
  26:     0x7f3c7c13b224 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hb1d364ffec9766dd
  27:     0x7f3c7c15bff8 - rustc_data_structures::stack::ensure_sufficient_stack::h78bedacf1b629dae
  28:     0x7f3c7c0f553f - rustc_query_system::query::plumbing::get_query_impl::hae23db8b793ce1d9
  29:     0x7f3c7c148f60 - rustc_symbol_mangling::test::SymbolNamesTest::process_attrs::hebc886ab52dfdd0d
  30:     0x7f3c7c159192 - rustc_hir::hir::Crate::visit_all_item_likes::h62efe572d73c0a6a
  31:     0x7f3c7c14b880 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h33f88e40c117739a
  32:     0x7f3c7c148a9b - rustc_symbol_mangling::test::report_symbol_names::h2a7d9459544458aa
  33:     0x7f3c7aa548c3 - rustc_codegen_ssa::base::codegen_crate::h4313da1caeb975f4
  34:     0x7f3c7aaa5c15 - <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate::h1f72f419f7c76d35
  35:     0x7f3c7a83b200 - rustc_session::utils::<impl rustc_session::session::Session>::time::h8dfa67a2b53454b3
  36:     0x7f3c7a87bae1 - rustc_interface::queries::Queries::ongoing_codegen::hdbedbe8cc863565e
  37:     0x7f3c7a653e1a - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::hec6b32330aacb990
  38:     0x7f3c7a61aca2 - rustc_span::with_source_map::haf40dc27442e4810
  39:     0x7f3c7a655f62 - rustc_interface::interface::create_compiler_and_run::he1b8461f8d09ca91
  40:     0x7f3c7a63ccca - scoped_tls::ScopedKey<T>::set::h4a8a2485893e8de6
  41:     0x7f3c7a65a795 - std::sys_common::backtrace::__rust_begin_short_backtrace::h8668b1999ab0e792
  42:     0x7f3c7a5d941e - core::ops::function::FnOnce::call_once{{vtable.shim}}::h36ffd177bfc9cab1
  43:     0x7f3c7944220a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h588ce842808b3fd0
                               at /rustc/1eaadebb3dee31669c7649b32747381d11614fae/library/alloc/src/boxed.rs:1042:9
  44:     0x7f3c7944220a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h46bc655f05471a92
                               at /rustc/1eaadebb3dee31669c7649b32747381d11614fae/library/alloc/src/boxed.rs:1042:9
  45:     0x7f3c7944220a - std::sys::unix::thread::Thread::new::thread_start::hb4b79d379b730058
                               at /rustc/1eaadebb3dee31669c7649b32747381d11614fae/library/std/src/sys/unix/thread.rs:89:17
  46:     0x7f3c7933d3e9 - start_thread
  47:     0x7f3c7925a293 - __GI___clone
  48:                0x0 - <unknown>

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.49.0-nightly (1eaadebb3 2020-10-21) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [symbol_name] computing the symbol for `Unsigned::<11_u8>`
end of query stack
error: aborting due to previous error

</p> </details>

created time in 4 days

issue openedrust-lang/rust

ICE: cannot convert to a region vid: glacier 75323 with -Zsave-analysis

<!-- Thank you for finding an Internal Compiler Error! 🧊 If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples.

http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/

-->

Code

code is from fixed/75323.rs of glacier

#![feature(min_const_generics)]

fn test<const N: usize>() {}

fn wow<'a>() -> &'a () {
    test::<
        {
            let _: &'a ();
            3
        },
    >();
    &()
}

Meta

<!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. -->

rustc --version --verbose:

rustc 1.49.0-nightly (31530e5d1 2020-10-20)
binary: rustc
commit-hash: 31530e5d132ebcc3654baf2e5460599681520af0
commit-date: 2020-10-20
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly
LLVM version: 11.0

Error output

rustc ./75323.rs -Zsave-analysis

error[E0601]: `main` function not found in crate `75323`
  --> ./75323.rs:1:1
   |
1  | / #![feature(min_const_generics)]
2  | |
3  | | fn test<const N: usize>() {}
4  | |
...  |
12 | |     &()
13 | | }
   | |_^ consider adding a `main` function to `./75323.rs`

error[E0658]: a non-static lifetime is not allowed in a `const`
 --> ./75323.rs:8:21
  |
8 |             let _: &'a ();
  |                     ^^
  |
  = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
  = help: add `#![feature(const_generics)]` to the crate attributes to enable

error: internal compiler error: compiler/rustc_mir/src/borrow_check/universal_regions.rs:768:36: cannot convert `ReEarlyBound(0, 'a)` to a region vid

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:945:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.49.0-nightly (31530e5d1 2020-10-20) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z save-analysis

query stack during panic:
#0 [mir_borrowck_const_arg] borrow-checking the const argument`wow::{constant#0}`
#1 [mir_drops_elaborated_and_const_checked] elaborating drops for `wow::{constant#0}`
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0601, E0658.
For more information about an error, try `rustc --explain E0601`.

<!-- Include a backtrace in the code block by setting RUST_BACKTRACE=1 in your environment. E.g. RUST_BACKTRACE=1 cargo build. --> <details><summary><strong>Backtrace</strong></summary> <p>

error[E0601]: `main` function not found in crate `75323`
  --> ./75323.rs:1:1
   |
1  | / #![feature(min_const_generics)]
2  | |
3  | | fn test<const N: usize>() {}
4  | |
...  |
12 | |     &()
13 | | }
   | |_^ consider adding a `main` function to `./75323.rs`

error[E0658]: a non-static lifetime is not allowed in a `const`
 --> ./75323.rs:8:21
  |
8 |             let _: &'a ();
  |                     ^^
  |
  = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
  = help: add `#![feature(const_generics)]` to the crate attributes to enable

error: internal compiler error: compiler/rustc_mir/src/borrow_check/universal_regions.rs:768:36: cannot convert `ReEarlyBound(0, 'a)` to a region vid

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:945:9
stack backtrace:
   0:     0x7f852bc9fa00 - std::backtrace_rs::backtrace::libunwind::trace::h622bab51c72c4e69
                               at /rustc/31530e5d132ebcc3654baf2e5460599681520af0/library/std/src/../../backtrace/src/backtrace/libunwind.rs:100:5
   1:     0x7f852bc9fa00 - std::backtrace_rs::backtrace::trace_unsynchronized::h7e820b882ebd41ee
                               at /rustc/31530e5d132ebcc3654baf2e5460599681520af0/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f852bc9fa00 - std::sys_common::backtrace::_print_fmt::h64d46258114db92f
                               at /rustc/31530e5d132ebcc3654baf2e5460599681520af0/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f852bc9fa00 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h47111d0c1b5f0da5
                               at /rustc/31530e5d132ebcc3654baf2e5460599681520af0/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7f852bd0e8fc - core::fmt::write::h1857a60b204f1b6a
                               at /rustc/31530e5d132ebcc3654baf2e5460599681520af0/library/core/src/fmt/mod.rs:1076:17
   5:     0x7f852bc91622 - std::io::Write::write_fmt::h4604516fed3e5731
                               at /rustc/31530e5d132ebcc3654baf2e5460599681520af0/library/std/src/io/mod.rs:1516:15
   6:     0x7f852bca49a5 - std::sys_common::backtrace::_print::h785e7a78d5ef272c
                               at /rustc/31530e5d132ebcc3654baf2e5460599681520af0/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f852bca49a5 - std::sys_common::backtrace::print::h108047ac5c4555d5
                               at /rustc/31530e5d132ebcc3654baf2e5460599681520af0/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f852bca49a5 - std::panicking::default_hook::{{closure}}::h1d0c271f0d087ebf
                               at /rustc/31530e5d132ebcc3654baf2e5460599681520af0/library/std/src/panicking.rs:208:50
   9:     0x7f852bca4648 - std::panicking::default_hook::h692753e26f11b7b7
                               at /rustc/31530e5d132ebcc3654baf2e5460599681520af0/library/std/src/panicking.rs:227:9
  10:     0x7f852cea3878 - rustc_driver::report_ice::h027627aaa525f0b3
  11:     0x7f852bca51e6 - std::panicking::rust_panic_with_hook::h74ddc20305301cd9
                               at /rustc/31530e5d132ebcc3654baf2e5460599681520af0/library/std/src/panicking.rs:581:17
  12:     0x7f852fe7b1bd - std::panicking::begin_panic::{{closure}}::hde64e7753bb51667
  13:     0x7f852fe7b0e6 - std::sys_common::backtrace::__rust_end_short_backtrace::h6567ed4099b888c3
  14:     0x7f852fe7b12f - std::panicking::begin_panic::h5911b197bf270d50
  15:     0x7f852feb1b20 - rustc_errors::HandlerInner::bug::hbb6554bd4fbc8852
  16:     0x7f852feb0600 - rustc_errors::Handler::bug::h4feefeec7bb726ca
  17:     0x7f852f921e04 - rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}::h22b92ed7b73b8340
  18:     0x7f852f91addb - rustc_middle::ty::context::tls::with_opt::{{closure}}::h32bfd9cf0b0a9393
  19:     0x7f852f91ad82 - rustc_middle::ty::context::tls::with_opt::h762464f893de2d96
  20:     0x7f852f921d29 - rustc_middle::util::bug::opt_span_bug_fmt::h05648c19bbf99518
  21:     0x7f852f921c9e - rustc_middle::util::bug::bug_fmt::h5d4f7ed12a8f1d0d
  22:     0x7f852e4aa218 - rustc_mir::borrow_check::universal_regions::UniversalRegionIndices::to_region_vid::{{closure}}::hf1cfeaddaf45e88c
  23:     0x7f852e4aa1ba - rustc_mir::borrow_check::universal_regions::UniversalRegionIndices::to_region_vid::hccb8f83ac4bad7f0
  24:     0x7f852e26c1b6 - <rustc_mir::borrow_check::type_check::relate_tys::NllTypeRelatingDelegate as rustc_infer::infer::nll_relate::TypeRelatingDelegate>::push_outlives::h2ffdf4671223a672
  25:     0x7f852e6b44fb - <rustc_infer::infer::nll_relate::TypeRelating<D> as rustc_middle::ty::relate::TypeRelation>::regions::h8c31c442627ef154
  26:     0x7f852e58527e - rustc_middle::ty::relate::super_relate_tys::hc5911a2c0f15c074
  27:     0x7f852e188990 - rustc_infer::infer::combine::<impl rustc_infer::infer::InferCtxt>::super_combine_tys::h3d3ad3d62befd183
  28:     0x7f852e6b91e2 - rustc_middle::ty::relate::TypeRelation::relate::h2a4e9143279a033e
  29:     0x7f852e2733d3 - rustc_mir::borrow_check::type_check::TypeChecker::relate_types::hd539c5511c6f43ab
  30:     0x7f852e26cbd5 - rustc_mir::borrow_check::type_check::type_check::hfcac3934a4212663
  31:     0x7f852e55201d - rustc_mir::borrow_check::nll::compute_regions::hfe8f6f3c0c79355b
  32:     0x7f852e6f77de - rustc_mir::borrow_check::do_mir_borrowck::h4acacd61f33a7b7e
  33:     0x7f852e187c36 - rustc_infer::infer::InferCtxtBuilder::enter::hd5556efaa818b431
  34:     0x7f852e6f47f9 - rustc_mir::borrow_check::mir_borrowck::h15a86e919fc8eed4
  35:     0x7f852e6c244d - core::ops::function::FnOnce::call_once::h6b5cd81feaed62a1
  36:     0x7f852e663de1 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_borrowck_const_arg>::compute::h1c235dfebf34f3fb
  37:     0x7f852e522ef2 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h447f2f9c670cca31
  38:     0x7f852e1969a1 - rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}::h0a727f0c1fa3ea1f
  39:     0x7f852e349b46 - rustc_query_system::query::plumbing::get_query_impl::h5a77fdf0ca4a365e
  40:     0x7f852e3a1497 - rustc_query_system::query::plumbing::ensure_query_impl::h2dc6fc7ec25057b8
  41:     0x7f852e6a7a16 - rustc_mir::transform::mir_drops_elaborated_and_const_checked::h997e03d7d6520c82
  42:     0x7f852e6645b1 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_drops_elaborated_and_const_checked>::compute::h79b4bbbf7058fe44
  43:     0x7f852e527e82 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h64e586cbce9e64b6
  44:     0x7f852e196ce1 - rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}::h982b6d1eaf0f3a7c
  45:     0x7f852e3286e6 - rustc_query_system::query::plumbing::get_query_impl::h15494dbf6f61984b
  46:     0x7f852e6a874f - rustc_mir::transform::optimized_mir_of_const_arg::h13cd2556e126ae60
  47:     0x7f852e5d97f1 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::optimized_mir_of_const_arg>::compute::h7b2baf865430142f
  48:     0x7f852e5228e2 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h39482e20e07fdf32
  49:     0x7f852e196be1 - rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}::h1f190f4e026249aa
  50:     0x7f852e36a526 - rustc_query_system::query::plumbing::get_query_impl::h8a363cab9886942b
  51:     0x7f852e5f5ef3 - rustc_mir::interpret::eval_context::InterpCx<M>::load_mir::h327c7a14867fd19b
  52:     0x7f852e55699c - rustc_mir::const_eval::eval_queries::eval_to_allocation_raw_provider::hdbcc3206940fc1d2
  53:     0x7f852e4fb9a4 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::eval_to_allocation_raw>::compute::h31b1b29c556c7ded
  54:     0x7f852e51cc4c - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h0841db549cb81a61
  55:     0x7f852e1a6153 - rustc_data_structures::stack::ensure_sufficient_stack::h985c8929d767037e
  56:     0x7f852e37e0b4 - rustc_query_system::query::plumbing::get_query_impl::hc00c5c2512c3fe67
  57:     0x7f852e556331 - rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider::h64c6c9052b7193d4
  58:     0x7f852e4fba94 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::eval_to_const_value_raw>::compute::h94bad924b5fbf46e
  59:     0x7f852e51f73f - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h20d567c800054b97
  60:     0x7f852e19d40d - rustc_data_structures::stack::ensure_sufficient_stack::h0876de69cfcf632b
  61:     0x7f852e323e8f - rustc_query_system::query::plumbing::get_query_impl::h0f5ace81a30d684c
  62:     0x7f852e556109 - rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider::h64c6c9052b7193d4
  63:     0x7f852fa48a1a - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::eval_to_const_value_raw>::compute::h94bad924b5fbf46e
  64:     0x7f852fd7b825 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::he90856ba60867bd1
  65:     0x7f852f9345eb - rustc_data_structures::stack::ensure_sufficient_stack::h057904aa47d6d3a3
  66:     0x7f852f738e5d - rustc_query_system::query::plumbing::get_query_impl::h9da5513325f7bad8
  67:     0x7f852fa103af - rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_global_id::hb50b9bb506785d22
  68:     0x7f852fa1011f - rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_resolve::hca0967fe0f4dba85
  69:     0x7f852f40823b - <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_middle::ty::fold::TypeFolder>::fold_const::hc4df9c8255f390aa
  70:     0x7f852f2af303 - rustc_middle::ty::fold::TypeFoldable::fold_with::ha1c1a9ef8ae08993
  71:     0x7f852f279ef4 - rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with::h5e381cb60f2c3857
  72:     0x7f852f407d1e - <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_middle::ty::fold::TypeFolder>::fold_ty::h0cf8cd9e525c21d2
  73:     0x7f852daf0002 - rustc_data_structures::stack::ensure_sufficient_stack::h83603224f3a2ec07
  74:     0x7f852d9edeb5 - rustc_trait_selection::traits::project::normalize::hbd026b7cfa08733e
  75:     0x7f852db9ed13 - <rustc_infer::infer::InferCtxt as rustc_trait_selection::infer::InferCtxtExt>::partially_normalize_associated_types_in::h6e59bd9035cfbfff
  76:     0x7f852db30632 - rustc_typeck::check::inherited::Inherited::normalize_associated_types_in::hd6f011cab5e375ac
  77:     0x7f852d905cbc - rustc_typeck::check::fn_ctxt::_impl::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::instantiate_value_path::hd12a53536fc1faf5
  78:     0x7f852d8f5497 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind::h85571b792e4e29aa
  79:     0x7f852d8f2d80 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation::h3d0ee6ad6d48cede
  80:     0x7f852d8e0a54 - rustc_typeck::check::callee::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_call::had823bacc17ba837
  81:     0x7f852d8f3aad - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind::h85571b792e4e29aa
  82:     0x7f852d8f2d80 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation::h3d0ee6ad6d48cede
  83:     0x7f852d90b795 - rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_stmt::h8c3b1cf29c1b9146
  84:     0x7f852d90be3b - rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected::heaf04a8a0c47c91a
  85:     0x7f852d8f3a85 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind::h85571b792e4e29aa
  86:     0x7f852d8f2d80 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation::h3d0ee6ad6d48cede
  87:     0x7f852d8fb86a - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr::h600e7dc6197fad7f
  88:     0x7f852d9f6b28 - rustc_typeck::check::check::check_fn::h3f68f05a04d05804
  89:     0x7f852db816b3 - rustc_infer::infer::InferCtxtBuilder::enter::h6881f9376e4471a9
  90:     0x7f852dc35158 - rustc_typeck::check::typeck::h7936b5f86fffb913
  91:     0x7f852cf7ba5e - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck>::compute::h3bcab1479531095c
  92:     0x7f852cf90ae7 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h3d62433f5dd808d3
  93:     0x7f852cfc1dc1 - rustc_data_structures::stack::ensure_sufficient_stack::h68019f69c1a798ed
  94:     0x7f852cf9ace9 - rustc_query_system::query::plumbing::get_query_impl::h3d64482a9838d020
  95:     0x7f852cf8468d - <rustc_save_analysis::dump_visitor::DumpVisitor as rustc_hir::intravisit::Visitor>::visit_item::h5037530d163aff96
  96:     0x7f852cf82a91 - rustc_save_analysis::dump_visitor::DumpVisitor::process_crate::haa90e2b94950fb5b
  97:     0x7f852ce33b72 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::hfcebd8e027c2eb95
  98:     0x7f852cef4e51 - std::thread::local::LocalKey<T>::with::hd08a8ed14b7ee110
  99:     0x7f852ce4ad6e - rustc_session::utils::<impl rustc_session::session::Session>::time::he58a1ab2e4ace9c1
 100:     0x7f852ce3418d - rustc_interface::passes::QueryContext::enter::h59c6397c0177fee2
 101:     0x7f852cec5908 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::hec6b32330aacb990
 102:     0x7f852cea81b7 - rustc_span::with_source_map::haf40dc27442e4810
 103:     0x7f852cec0d21 - scoped_tls::ScopedKey<T>::set::h4a8a2485893e8de6
 104:     0x7f852cec99c5 - std::sys_common::backtrace::__rust_begin_short_backtrace::h8668b1999ab0e792
 105:     0x7f852ce509de - core::ops::function::FnOnce::call_once{{vtable.shim}}::h36ffd177bfc9cab1
 106:     0x7f852bcb41ea - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h588ce842808b3fd0
                               at /rustc/31530e5d132ebcc3654baf2e5460599681520af0/library/alloc/src/boxed.rs:1042:9
 107:     0x7f852bcb41ea - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h46bc655f05471a92
                               at /rustc/31530e5d132ebcc3654baf2e5460599681520af0/library/alloc/src/boxed.rs:1042:9
 108:     0x7f852bcb41ea - std::sys::unix::thread::Thread::new::thread_start::hb4b79d379b730058
                               at /rustc/31530e5d132ebcc3654baf2e5460599681520af0/library/std/src/sys/unix/thread.rs:89:17
 109:     0x7f852bbaf3e9 - start_thread
 110:     0x7f852bacc293 - __GI___clone
 111:                0x0 - <unknown>

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.49.0-nightly (31530e5d1 2020-10-20) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z save-analysis

query stack during panic:
#0 [mir_borrowck_const_arg] borrow-checking the const argument`wow::{constant#0}`
#1 [mir_drops_elaborated_and_const_checked] elaborating drops for `wow::{constant#0}`
#2 [optimized_mir_of_const_arg] optimizing MIR for the const argument `wow::{constant#0}`
#3 [eval_to_allocation_raw] const-evaluating + checking `wow::{constant#0}`
#4 [eval_to_const_value_raw] simplifying constant for the type system `wow::{constant#0}`
#5 [eval_to_const_value_raw] simplifying constant for the type system `wow::{constant#0}`
#6 [typeck] type-checking `wow`
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0601, E0658.
For more information about an error, try `rustc --explain E0601`.

</p> </details>

created time in 6 days

issue commentrust-lang/rust

tuple_fields called on non-tuple

duplicate of https://github.com/rust-lang/rust/issues/77993

blasrodri

comment created time in 7 days

pull request commentrust-lang/rust

Add lint for panic!("{}")

Clippy already has a lint for panic!("{}") https://rust-lang.github.io/rust-clippy/master/index.html#panic_params (not sure about assert! though..)

m-ou-se

comment created time in 8 days

issue openedmatthiaskrgr/cargo-cache

rustup toolchain size stats

created time in 8 days

push eventmatthiaskrgr/cargo-cache

Matthias Krüger

commit sha 5e33be0cf1f587135ff232450d481e48d0407d11

Cargo.toml: make sure deps are sorted alphabetically

view details

push time in 10 days

push eventmatthiaskrgr/cargo-cache

Matthias Krüger

commit sha f0f23aabe58660751b1e83d6ce2f0328eb855c1c

update deps

view details

push time in 10 days

push eventmatthiaskrgr/cargo-cache

Matthias Krüger

commit sha 0bd16be12a8f161eee75d324801163ebd9b6edea

formatting

view details

push time in 10 days

push eventmatthiaskrgr/cargo-cache

Matthias Krüger

commit sha aaf1eedd5126bb6df4561cf4ca19144c8addc71f

perf: don't create owned Strings just for calling .contains('x') on them

view details

push time in 10 days

issue commentrust-lang/rust

ICE: tuple_fields called on non-tuple: ./compiler/rustc_middle/src/hir/place.rs

Cargo-bisetc-rustc points to 93deabce03dc10a80244f5da3e3819452744da2a / https://github.com/rust-lang/rust/pull/77873

matthiaskrgr

comment created time in 11 days

issue commentrust-lang/rust

ICE: tuple_fields called on non-tuple: ./compiler/rustc_middle/src/hir/place.rs

Reduced code from another project that also triggers this ICE:

async fn test() -> Result<(), Box<dyn std::error::Error>> {
    macro!();
    Ok(())
}
matthiaskrgr

comment created time in 11 days

issue openedrust-lang/rust

ICE: tuple_fields called on non-tuple: ./compiler/rustc_middle/src/hir/place.rs

<!-- Thank you for finding an Internal Compiler Error! 🧊 If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples.

http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/

-->

Code

code is ./compiler/rustc_middle/src/hir/place.rs @ 7f587168102498a488abf608a86c7fdfa62fb7bb

<code>

Meta

<!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. -->

rustc --version --verbose:

rustc 1.49.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.49.0-dev
LLVM version: 11.0

Error output

error[E0432]: unresolved import `crate::ty`
 --> ./compiler/rustc_middle/src/hir/place.rs:1:5
  |
1 | use crate::ty;
  |     ^^^^^^^--
  |     |      |
  |     |      help: a similar name exists in the module: `Ty`
  |     no `ty` in the root

error[E0433]: failed to resolve: maybe a missing crate `rustc_target`?
 --> ./compiler/rustc_middle/src/hir/place.rs:5:5
  |
5 | use rustc_target::abi::VariantIdx;
  |     ^^^^^^^^^^^^ maybe a missing crate `rustc_target`?

error[E0432]: unresolved import `rustc_hir`
 --> ./compiler/rustc_middle/src/hir/place.rs:4:5
  |
4 | use rustc_hir::HirId;
  |     ^^^^^^^^^ maybe a missing crate `rustc_hir`?

error: cannot find derive macro `TyEncodable` in this scope
 --> ./compiler/rustc_middle/src/hir/place.rs:7:51
  |
7 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, TyEncodable, TyDecodable, HashStable)]
  |                                                   ^^^^^^^^^^^

error: cannot find derive macro `TyDecodable` in this scope
 --> ./compiler/rustc_middle/src/hir/place.rs:7:64
  |
7 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, TyEncodable, TyDecodable, HashStable)]
  |                                                                ^^^^^^^^^^^

error: cannot find derive macro `HashStable` in this scope
 --> ./compiler/rustc_middle/src/hir/place.rs:7:77
  |
7 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, TyEncodable, TyDecodable, HashStable)]
  |                                                                             ^^^^^^^^^^

error: cannot find derive macro `TyEncodable` in this scope
  --> ./compiler/rustc_middle/src/hir/place.rs:19:51
   |
19 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, TyEncodable, TyDecodable, HashStable)]
   |                                                   ^^^^^^^^^^^

error: cannot find derive macro `TyDecodable` in this scope
  --> ./compiler/rustc_middle/src/hir/place.rs:19:64
   |
19 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, TyEncodable, TyDecodable, HashStable)]
   |                                                                ^^^^^^^^^^^

error: cannot find derive macro `HashStable` in this scope
  --> ./compiler/rustc_middle/src/hir/place.rs:19:77
   |
19 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, TyEncodable, TyDecodable, HashStable)]
   |                                                                             ^^^^^^^^^^

error: cannot find derive macro `TyEncodable` in this scope
  --> ./compiler/rustc_middle/src/hir/place.rs:39:51
   |
39 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, TyEncodable, TyDecodable, HashStable)]
   |                                                   ^^^^^^^^^^^

error: cannot find derive macro `TyDecodable` in this scope
  --> ./compiler/rustc_middle/src/hir/place.rs:39:64
   |
39 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, TyEncodable, TyDecodable, HashStable)]
   |                                                                ^^^^^^^^^^^

error: cannot find derive macro `HashStable` in this scope
  --> ./compiler/rustc_middle/src/hir/place.rs:39:77
   |
39 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, TyEncodable, TyDecodable, HashStable)]
   |                                                                             ^^^^^^^^^^

error: cannot find derive macro `TyEncodable` in this scope
  --> ./compiler/rustc_middle/src/hir/place.rs:51:45
   |
51 | #[derive(Clone, Debug, PartialEq, Eq, Hash, TyEncodable, TyDecodable, HashStable)]
   |                                             ^^^^^^^^^^^

error: cannot find derive macro `TyDecodable` in this scope
  --> ./compiler/rustc_middle/src/hir/place.rs:51:58
   |
51 | #[derive(Clone, Debug, PartialEq, Eq, Hash, TyEncodable, TyDecodable, HashStable)]
   |                                                          ^^^^^^^^^^^

error: cannot find derive macro `HashStable` in this scope
  --> ./compiler/rustc_middle/src/hir/place.rs:51:71
   |
51 | #[derive(Clone, Debug, PartialEq, Eq, Hash, TyEncodable, TyDecodable, HashStable)]
   |                                                                       ^^^^^^^^^^

error: cannot find derive macro `TyEncodable` in this scope
  --> ./compiler/rustc_middle/src/hir/place.rs:64:45
   |
64 | #[derive(Clone, Debug, PartialEq, Eq, Hash, TyEncodable, TyDecodable, HashStable)]
   |                                             ^^^^^^^^^^^

error: cannot find derive macro `TyDecodable` in this scope
  --> ./compiler/rustc_middle/src/hir/place.rs:64:58
   |
64 | #[derive(Clone, Debug, PartialEq, Eq, Hash, TyEncodable, TyDecodable, HashStable)]
   |                                                          ^^^^^^^^^^^

error: cannot find derive macro `HashStable` in this scope
  --> ./compiler/rustc_middle/src/hir/place.rs:64:71
   |
64 | #[derive(Clone, Debug, PartialEq, Eq, Hash, TyEncodable, TyDecodable, HashStable)]
   |                                                                       ^^^^^^^^^^

error[E0412]: cannot find type `VariantIdx` in this scope
  --> ./compiler/rustc_middle/src/hir/place.rs:28:16
   |
28 |     Field(u32, VariantIdx),
   |                ^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `Ty` in this scope
  --> ./compiler/rustc_middle/src/hir/place.rs:42:13
   |
42 |     pub ty: Ty<'tcx>,
   |             ^^ not found in this scope

error[E0412]: cannot find type `Ty` in this scope
  --> ./compiler/rustc_middle/src/hir/place.rs:54:18
   |
54 |     pub base_ty: Ty<'tcx>,
   |                  ^^ not found in this scope

error[E0412]: cannot find type `Ty` in this scope
  --> ./compiler/rustc_middle/src/hir/place.rs:76:18
   |
76 |         base_ty: Ty<'tcx>,
   |                  ^^ not found in this scope

error[E0412]: cannot find type `Ty` in this scope
  --> ./compiler/rustc_middle/src/hir/place.rs:94:53
   |
94 |     pub fn deref_tys(&self) -> impl Iterator<Item = Ty<'tcx>> + '_ {
   |                                                     ^^ not found in this scope

error[E0412]: cannot find type `Ty` in this scope
   --> ./compiler/rustc_middle/src/hir/place.rs:105:25
    |
105 |     pub fn ty(&self) -> Ty<'tcx> {
    |                         ^^ not found in this scope

error[E0412]: cannot find type `Ty` in this scope
   --> ./compiler/rustc_middle/src/hir/place.rs:111:68
    |
111 |     pub fn ty_before_projection(&self, projection_index: usize) -> Ty<'tcx> {
    |                                                                    ^^ not found in this scope

error[E0601]: `main` function not found in crate `place`
   --> ./compiler/rustc_middle/src/hir/place.rs:1:1
    |
1   | / use crate::ty;
2   | | use crate::ty::Ty;
3   | |
4   | | use rustc_hir::HirId;
...   |
114 | |     }
115 | | }
    | |_^ consider adding a `main` function to `./compiler/rustc_middle/src/hir/place.rs`

error: internal compiler error: compiler/rustc_middle/src/ty/sty.rs:2124:18: tuple_fields called on non-tuple

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:945:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.49.0-dev running on x86_64-unknown-linux-gnu

error: aborting due to 27 previous errors

Some errors have detailed explanations: E0412, E0432, E0433, E0601.
For more information about an error, try `rustc --explain E0412`.

<!-- Include a backtrace in the code block by setting RUST_BACKTRACE=1 in your environment. E.g. RUST_BACKTRACE=1 cargo build. --> <details><summary><strong>Backtrace</strong></summary> <p>

error: internal compiler error: compiler/rustc_middle/src/ty/sty.rs:2124:18: tuple_fields called on non-tuple

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:945:9
stack backtrace:
   0:     0x7f93bc5e04bd - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1b767c39a5e95889
   1:     0x7f93bc65385f - core::fmt::write::h171574b7e83e4159
   2:     0x7f93bc5db6b5 - std::io::Write::write_fmt::h367f0713939149e7
   3:     0x7f93bc5bb2dd - std::panicking::default_hook::{{closure}}::h8d2944ffa3ea5b5c
   4:     0x7f93bc5bafe3 - std::panicking::default_hook::h417561cd3584a74e
   5:     0x7f93bd5adad8 - rustc_driver::report_ice::h7f907413f380ab0c
   6:     0x7f93bc5bba44 - std::panicking::rust_panic_with_hook::h177ff2dd6f6c5a3a
   7:     0x7f93c037a48d - std::panicking::begin_panic::{{closure}}::h41c30b7d59c1ab83
   8:     0x7f93c037a366 - std::sys_common::backtrace::__rust_end_short_backtrace::h9b4b887fe950ed7b
   9:     0x7f93c037a45f - std::panicking::begin_panic::h2d5e952ff02cd303
  10:     0x7f93c035f280 - rustc_errors::HandlerInner::bug::h54226bb6464c1bbe
  11:     0x7f93c035dd80 - rustc_errors::Handler::bug::h9c85e7413fc614bd
  12:     0x7f93bfd1a744 - rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}::hc8c879fae76cec68
  13:     0x7f93bfd03beb - rustc_middle::ty::context::tls::with_opt::{{closure}}::h1ee402a0368750e9
  14:     0x7f93bfd03b3a - rustc_middle::ty::context::tls::with_opt::h0b6e4a7db95180c0
  15:     0x7f93bfd1a669 - rustc_middle::util::bug::opt_span_bug_fmt::h9e8f475e44875520
  16:     0x7f93bfd1a5de - rustc_middle::util::bug::bug_fmt::hb53735ed1a0e40a3
  17:     0x7f93bfff9fe6 - rustc_middle::ty::sty::<impl rustc_middle::ty::TyS>::tuple_fields::hb1ebf2fff134a3a7
  18:     0x7f93bdf7b632 - <rustc_trait_selection::opaque_types::ConstrainOpaqueTypeRegionVisitor<OP> as rustc_middle::ty::fold::TypeVisitor>::visit_ty::h01e7fbbc634050bd
  19:     0x7f93bdf4381b - rustc_middle::ty::fold::TypeFoldable::visit_with::h89367421b2d9b62d
  20:     0x7f93bdf7b68b - <rustc_trait_selection::opaque_types::ConstrainOpaqueTypeRegionVisitor<OP> as rustc_middle::ty::fold::TypeVisitor>::visit_ty::h01e7fbbc634050bd
  21:     0x7f93be0e49b4 - <rustc_infer::infer::InferCtxt as rustc_trait_selection::opaque_types::InferCtxtExt>::constrain_opaque_types::h030521a243b98e15
  22:     0x7f93be0131be - rustc_typeck::check::regionck::RegionCtxt::visit_fn_body::ha1d50d9c7b0b26de
  23:     0x7f93be24bbf5 - rustc_hir::intravisit::walk_expr::hd9b61c2e865b355d
  24:     0x7f93be013f05 - <rustc_typeck::check::regionck::RegionCtxt as rustc_hir::intravisit::Visitor>::visit_expr::h5d9582afe4a90429
  25:     0x7f93be24ba0d - rustc_hir::intravisit::walk_expr::hd9b61c2e865b355d
  26:     0x7f93be013f05 - <rustc_typeck::check::regionck::RegionCtxt as rustc_hir::intravisit::Visitor>::visit_expr::h5d9582afe4a90429
  27:     0x7f93be013f05 - <rustc_typeck::check::regionck::RegionCtxt as rustc_hir::intravisit::Visitor>::visit_expr::h5d9582afe4a90429
  28:     0x7f93be01316d - rustc_typeck::check::regionck::RegionCtxt::visit_fn_body::ha1d50d9c7b0b26de
  29:     0x7f93be2c2314 - rustc_typeck::check::regionck::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::regionck_fn::h962b154ec40bba78
  30:     0x7f93be087dc4 - rustc_infer::infer::InferCtxtBuilder::enter::h0bfbb1500ae865a9
  31:     0x7f93be2c5deb - rustc_typeck::check::typeck::hb09642c9af5e80c9
  32:     0x7f93c01d3a85 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h57f4225023d78b56
  33:     0x7f93bfb90344 - rustc_data_structures::stack::ensure_sufficient_stack::h71466b197f75449b
  34:     0x7f93c00ab2c3 - rustc_query_system::query::plumbing::get_query_impl::h9360744ca1554fcf
  35:     0x7f93bfcf71c7 - rustc_middle::ty::context::TyCtxt::typeck_opt_const_arg::h2d84bcba4b6a916a
  36:     0x7f93be6f6b88 - rustc_mir_build::thir::cx::Cx::new::hccb17ee027ff76f8
  37:     0x7f93be649728 - rustc_infer::infer::InferCtxtBuilder::enter::hb2e57772975e2b6a
  38:     0x7f93be6c9843 - rustc_mir_build::build::mir_built::h67c74896e86647aa
  39:     0x7f93be9af671 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_built>::compute::hab082082a34c2a66
  40:     0x7f93be80d592 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h4f2d7a4f42060b81
  41:     0x7f93be7c3651 - rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}::hb3cb65dbe2e759d9
  42:     0x7f93beb1c85c - rustc_query_system::query::plumbing::get_query_impl::h605fe8d0d7bd6b92
  43:     0x7f93bea9ee8f - rustc_mir::transform::check_unsafety::unsafety_check_result::hb95b5ba5b034d78c
  44:     0x7f93be9c7dd5 - core::ops::function::FnOnce::call_once::h6e90cec670018759
  45:     0x7f93be7ba9ae - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::unsafety_check_result>::compute::h152644ff7a03cdd3
  46:     0x7f93be807967 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h280484e180fb4db4
  47:     0x7f93be7c693f - rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}::he829055f694efc53
  48:     0x7f93beafe7f8 - rustc_query_system::query::plumbing::get_query_impl::h41c1bf045ca18433
  49:     0x7f93beb9f55d - rustc_query_system::query::plumbing::ensure_query_impl::h86c0638fa615d35e
  50:     0x7f93be97c255 - rustc_mir::transform::mir_const::hdeb59516dc5aaff7
  51:     0x7f93be7b9611 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_const>::compute::h71b8dfe9e2067e93
  52:     0x7f93be80d592 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h4f2d7a4f42060b81
  53:     0x7f93be7c3651 - rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}::hb3cb65dbe2e759d9
  54:     0x7f93beb1c85c - rustc_query_system::query::plumbing::get_query_impl::h605fe8d0d7bd6b92
  55:     0x7f93be97f418 - rustc_mir::transform::mir_promoted::he979c564ee05d4ea
  56:     0x7f93be9afb51 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_promoted>::compute::h092e01bedcd3549c
  57:     0x7f93be81186e - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h979aaf5f3b5750e4
  58:     0x7f93be7c3997 - rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}::hba4807a6a5016e2c
  59:     0x7f93beb9ce35 - rustc_query_system::query::plumbing::get_query_impl::hfeddd0a9eec98c42
  60:     0x7f93bea75c94 - rustc_mir::borrow_check::mir_borrowck::h7c6e60de406657c1
  61:     0x7f93be9c7ea5 - core::ops::function::FnOnce::call_once::h73be7b98bfa4558f
  62:     0x7f93be145abe - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_borrowck>::compute::h3da8bb2f97c9a422
  63:     0x7f93bdf8af82 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h44ec7da1ac743b22
  64:     0x7f93bdf57b5f - rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}::h779a44164ac87397
  65:     0x7f93be1b72cd - rustc_query_system::query::plumbing::get_query_impl::had8ea137560d0ac3
  66:     0x7f93be2c9ec5 - rustc_typeck::collect::type_of::type_of::h044fbee69942caec
  67:     0x7f93be14550f - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::type_of>::compute::h997915d7c4a1b6ad
  68:     0x7f93bdf94513 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hc90b97085c9ce79e
  69:     0x7f93bdf59d85 - rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}::haadc1467f2e67bc8
  70:     0x7f93be16b6cd - rustc_query_system::query::plumbing::get_query_impl::h2c99a7423ad0a9fb
  71:     0x7f93be26c498 - rustc_typeck::check::check::check_item_type::hcc025041b3995db8
  72:     0x7f93bdf6ad69 - rustc_middle::hir::map::Map::visit_item_likes_in_module::h90978f22ba1ebf3d
  73:     0x7f93be2759fd - rustc_typeck::check::check::check_mod_item_types::h74b4e4a96dd67240
  74:     0x7f93bdf5117e - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::check_mod_item_types>::compute::h2799a561a93c2553
  75:     0x7f93bdf87b52 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h2a25f28c9bf78af6
  76:     0x7f93bdfa4594 - rustc_data_structures::stack::ensure_sufficient_stack::ha0c669f9d949c5f8
  77:     0x7f93be16e0be - rustc_query_system::query::plumbing::get_query_impl::h2f050535db18ce4a
  78:     0x7f93be1f8f3e - rustc_query_system::query::plumbing::ensure_query_impl::h96e25221e74cb65c
  79:     0x7f93be042380 - rustc_typeck::check_crate::h2f3d09a5c21b8584
  80:     0x7f93bd8ff030 - rustc_interface::passes::analysis::h81d211764a272d26
  81:     0x7f93bd544522 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute::h1a58c8624477b89e
  82:     0x7f93bd5585b2 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h62cc43b86c88c41d
  83:     0x7f93bd54471f - rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}::h1a866b1492cf42e8
  84:     0x7f93bd6c94d1 - rustc_query_system::query::plumbing::get_query_impl::hcbdd933478ab0e9e
  85:     0x7f93bd5610ff - std::sys_common::backtrace::__rust_begin_short_backtrace::h724ca6f06aa5850a
  86:     0x7f93bd6d274e - core::ops::function::FnOnce::call_once{{vtable.shim}}::hff6c249ae73bdeba
  87:     0x7f93bc5c270a - std::sys::unix::thread::Thread::new::thread_start::h92d814023fa5e376
  88:     0x7f93b91053e9 - start_thread
  89:     0x7f93bc3ca293 - __GI___clone
  90:                0x0 - <unknown>

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.49.0-dev running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `Place::<'tcx>::deref_tys`
#1 [mir_built] building MIR for `Place::<'tcx>::deref_tys`
#2 [unsafety_check_result] unsafety-checking `Place::<'tcx>::deref_tys`
#3 [mir_const] processing MIR for `Place::<'tcx>::deref_tys`
#4 [mir_promoted] processing `Place::<'tcx>::deref_tys`
#5 [mir_borrowck] borrow-checking `Place::<'tcx>::deref_tys`
#6 [type_of] computing type of `Place<'tcx>::deref_tys::{opaque#0}`
#7 [check_mod_item_types] checking item types in top-level module
#8 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 27 previous errors

Some errors have detailed explanations: E0412, E0432, E0433, E0601.
For more information about an error, try `rustc --explain E0412`.

</p> </details>

created time in 11 days

issue commentrust-lang/rust-clippy

CLIPPY_FLAGS to pass options to clippy/ enable disable lints via env vars

Yeah, looks like RUSTFLAGS="-Aclippy::needless_return" cargo clippy no longer throws errors! :tada:

matthiaskrgr

comment created time in 11 days

issue commentrust-analyzer/rust-analyzer

RA reports syntax error on if inside let

Looks like this works fine now. Feel free to close, unless you want to add some sort of test for this to RA.

matthiaskrgr

comment created time in 11 days

issue commentmozilla/sccache

sccache: error: Server startup failed: Address already in use (os error 98)

Seems to be working, indeed. Thanks!

matthiaskrgr

comment created time in 11 days

issue closedmozilla/sccache

sccache: error: Server startup failed: Address already in use (os error 98)

In the last 2(?) weeks I saw this error happening A LOT, mostly while compiling rustc.

sccache: error: Server startup failed: Address already in use (os error 98)
error: could not compile `rustc_symbol_mangling`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
sccache: error: Server startup failed: Address already in use (os error 98)
sccache: error: Server startup failed: Address already in use (os error 98)

This did not happen previously and it's quite annoying.

closed time in 11 days

matthiaskrgr
PullRequestReviewEvent

issue openedrust-lang/rust-clippy

FP same_functions_in_if_condition with cfg!() with macro as condition

I tried this code:

#![warn(clippy::same_functions_in_if_condition)]
pub fn main() {
    let os = if cfg!(target_os = "macos") {
        "macos"
    } else if cfg!(target_os = "windows") {
        "windows"
    } else {
        "linux"
    };

    println!("{}", os);
}

This will boil down to something like ... if false { "macos" } else if false { "windows" } else { "linux" } on linux, the lint should probably just ignore exprs that originate from macros?

current warning:

warning: this `if` has the same function call as a previous `if`
 --> src/main.rs:5:15
  |
5 |     } else if cfg!(target_os = "windows") {
  |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
note: the lint level is defined here
 --> src/main.rs:1:9
  |
1 | #![warn(clippy::same_functions_in_if_condition)]
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: same as this
 --> src/main.rs:3:17
  |
3 |     let os = if cfg!(target_os = "macos") {
  |                 ^^^^^^^^^^^^^^^^^^^^^^^^^
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#same_functions_in_if_condition
  = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

Meta

clippy 0.0.212 (8dae8cd 2020-10-12)

created time in 14 days

push eventmatthiaskrgr/cargo-cache

Matthias Krüger

commit sha cc7cf75d6849a2fc1386b32fc48280573eed8660

run cargo update to get rid of bad crossbeam-channel version 0.4.3 cargo-audit reported this: error: Vulnerable crates found! ID: RUSTSEC-2020-0052 Crate: crossbeam-channel Version: 0.4.3 Date: 2020-06-26 URL: https://rustsec.org/advisories/RUSTSEC-2020-0052 Title: Undefined Behavior in bounded channel Solution: upgrade to >= 0.4.4 Dependency tree: crossbeam-channel 0.4.3 └── rayon-core 1.8.0 └── rayon 1.4.0 ├── remove_dir_all 0.6.0 └── cargo-cache 0.5.1 warning: 1 warning found Crate: crossbeam-channel Version: 0.4.3 Warning: package has been yanked! error: 1 vulnerability found! warning: 1 warning found!

view details

push time in 14 days

pull request commentrust-lang/highfive

clippy: remove matthiaskrgr from reviewer group

https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/taking.20a.20break

matthiaskrgr

comment created time in 18 days

PR opened rust-lang/highfive

clippy: remove matthiaskrgr from reviewer group

I don't have the capacity to work a lot on clippy right now.

+2 -2

0 comment

1 changed file

pr created time in 18 days

create barnchmatthiaskrgr/highfive

branch : matthiaskrgr-review-group

created branch time in 18 days

fork matthiaskrgr/highfive

Github hooks to provide an encouraging atmosphere for new contributors

fork in 18 days

push eventmatthiaskrgr/cargo-cache

Amrit Rathie

commit sha 894bc626d8b6d4ec61d33642bc6b54762da7cad3

Generalize backup scripts

view details

Matthias Krüger

commit sha 3cefd2e864e5ae28cf3a9c079c5f901a00f78f41

Merge pull request #91 from Spaceface16518/master Generalize backup scripts

view details

push time in 18 days

PR merged matthiaskrgr/cargo-cache

Generalize backup scripts

This will make contributing to the project easier because the utilities will work for most everyone out of the box.

I didn't know if I had to make a changelog entry for this, but if I do, feel free mention that in a review. Thanks!

+4 -4

0 comment

2 changed files

Spaceface16518

pr closed time in 18 days

PullRequestReviewEvent

issue commentrust-lang/rust

ICE issue-36839.rs could not fully normalize `<() as Foo>::Bar` with --emit=mir

The crash is repro'able in stable now.

matthiaskrgr

comment created time in 19 days

issue closedrust-lang/rust

ICE: issue-37725.rs -Zmir-opt-level=2 --emit mir

<!-- Thank you for finding an Internal Compiler Error! 🧊 If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples.

http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/

--> interestingly this one only crashes with -Zmir-opt-level=2 AND --emit mir

Code

./src/test/ui/issues/issue-37725.rs

// build-pass
#![allow(dead_code)]
trait Foo {
    fn foo(&self);
}

fn foo<'a>(s: &'a mut ()) where &'a mut (): Foo {
    s.foo();
}
fn main() {}

Meta

<!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. -->

rustc --version --verbose:

rustc 1.49.0-nightly (98edd1fbf 2020-10-06)
binary: rustc
commit-hash: 98edd1fbf8a68977a2a7c1312eb1ebff80515a92
commit-date: 2020-10-06
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly
LLVM version: 11.0

Error output

error: internal compiler error: Encountered error `Unimplemented` selecting `Binder(<&mut () as Foo>)` during codegen
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/codegen/mod.rs:65:32

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:961:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.49.0-nightly (98edd1fbf 2020-10-06) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z mir-opt-level=2

<!-- Include a backtrace in the code block by setting RUST_BACKTRACE=1 in your environment. E.g. RUST_BACKTRACE=1 cargo build. --> <details><summary><strong>Backtrace</strong></summary> <p>

error: internal compiler error: Encountered error `Unimplemented` selecting `Binder(<&mut () as Foo>)` during codegen
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/codegen/mod.rs:65:32

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:961:13
stack backtrace:
   0:     0x7fdf59d2b0b0 - std::backtrace_rs::backtrace::libunwind::trace::h622bab51c72c4e69
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/../../backtrace/src/backtrace/libunwind.rs:96
   1:     0x7fdf59d2b0b0 - std::backtrace_rs::backtrace::trace_unsynchronized::h7e820b882ebd41ee
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/../../backtrace/src/backtrace/mod.rs:66
   2:     0x7fdf59d2b0b0 - std::sys_common::backtrace::_print_fmt::h64d46258114db92f
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/sys_common/backtrace.rs:79
   3:     0x7fdf59d2b0b0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h47111d0c1b5f0da5
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/sys_common/backtrace.rs:58
   4:     0x7fdf59d9a07c - core::fmt::write::h1857a60b204f1b6a
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/core/src/fmt/mod.rs:1080
   5:     0x7fdf59d1d052 - std::io::Write::write_fmt::h4604516fed3e5731
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/io/mod.rs:1516
   6:     0x7fdf59d2fe7d - std::sys_common::backtrace::_print::h785e7a78d5ef272c
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/sys_common/backtrace.rs:61
   7:     0x7fdf59d2fe7d - std::sys_common::backtrace::print::h108047ac5c4555d5
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/sys_common/backtrace.rs:48
   8:     0x7fdf59d2fe7d - std::panicking::default_hook::{{closure}}::h1d0c271f0d087ebf
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/panicking.rs:208
   9:     0x7fdf59d2fb28 - std::panicking::default_hook::h692753e26f11b7b7
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/panicking.rs:227
  10:     0x7fdf5a5bd3e8 - rustc_driver::report_ice::h767ab601e5f63209
  11:     0x7fdf59d306c6 - std::panicking::rust_panic_with_hook::h74ddc20305301cd9
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/panicking.rs:581
  12:     0x7fdf59d30249 - std::panicking::begin_panic_handler::{{closure}}::h1a9ca6427ceee1d0
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/panicking.rs:484
  13:     0x7fdf59d2b54c - std::sys_common::backtrace::__rust_end_short_backtrace::h97e27b7ab754adde
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/sys_common/backtrace.rs:153
  14:     0x7fdf59d30209 - rust_begin_unwind
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/panicking.rs:483
  15:     0x7fdf59d301bb - std::panicking::begin_panic_fmt::h45d0f154d1dd3395
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/panicking.rs:437
  16:     0x7fdf5d5d9281 - rustc_errors::HandlerInner::flush_delayed::h4e44ea29efc5a508
  17:     0x7fdf5d5d5be1 - <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop::hc2218eb325dc8425
  18:     0x7fdf5a60ad76 - core::ptr::drop_in_place::he652386dc31d9e30
  19:     0x7fdf5a60cbc6 - <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop::h60c7e2432b201062
  20:     0x7fdf5a5e66fd - core::ptr::drop_in_place::h2f4d4236293b18c7
  21:     0x7fdf5a5e0dea - rustc_span::with_source_map::h23e56868796f6dc3
  22:     0x7fdf5a615ed2 - rustc_interface::interface::create_compiler_and_run::h9a8debbb19483b80
  23:     0x7fdf5a5f4d0a - scoped_tls::ScopedKey<T>::set::hacc47b1cdb25a215
  24:     0x7fdf5a618611 - std::sys_common::backtrace::__rust_begin_short_backtrace::h3d5db7946c19f316
  25:     0x7fdf5a59618e - core::ops::function::FnOnce::call_once{{vtable.shim}}::he1a30fa4d30a2178
  26:     0x7fdf59d3efda - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h588ce842808b3fd0
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/alloc/src/boxed.rs:1042
  27:     0x7fdf59d3efda - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h46bc655f05471a92
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/alloc/src/boxed.rs:1042
  28:     0x7fdf59d3efda - std::sys::unix::thread::Thread::new::thread_start::hb4b79d379b730058
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/sys/unix/thread.rs:87
  29:     0x7fdf59c3b3e9 - start_thread
  30:     0x7fdf59b58293 - __GI___clone
  31:                0x0 - <unknown>

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.49.0-nightly (98edd1fbf 2020-10-06) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z mir-opt-level=2

query stack during panic:
end of query stack

</p> </details>

closed time in 19 days

matthiaskrgr

issue commentrust-lang/rust

ICE: issue-37725.rs -Zmir-opt-level=2 --emit mir

oops, dupe of #73021

matthiaskrgr

comment created time in 19 days

issue openedrust-lang/rust

ICE: issue-37725.rs -Zmir-opt-level=2 --emit mir

<!-- Thank you for finding an Internal Compiler Error! 🧊 If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples.

http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/

--> interestingly this one only crashes with -Zmir-opt-level=2 AND --emit mir

Code

./src/test/ui/issues/issue-37725.rs

// build-pass
#![allow(dead_code)]
trait Foo {
    fn foo(&self);
}

fn foo<'a>(s: &'a mut ()) where &'a mut (): Foo {
    s.foo();
}
fn main() {}

Meta

<!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. -->

rustc --version --verbose:

rustc 1.49.0-nightly (98edd1fbf 2020-10-06)
binary: rustc
commit-hash: 98edd1fbf8a68977a2a7c1312eb1ebff80515a92
commit-date: 2020-10-06
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly
LLVM version: 11.0

Error output

error: internal compiler error: Encountered error `Unimplemented` selecting `Binder(<&mut () as Foo>)` during codegen
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/codegen/mod.rs:65:32

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:961:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.49.0-nightly (98edd1fbf 2020-10-06) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z mir-opt-level=2

<!-- Include a backtrace in the code block by setting RUST_BACKTRACE=1 in your environment. E.g. RUST_BACKTRACE=1 cargo build. --> <details><summary><strong>Backtrace</strong></summary> <p>

error: internal compiler error: Encountered error `Unimplemented` selecting `Binder(<&mut () as Foo>)` during codegen
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/codegen/mod.rs:65:32

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:961:13
stack backtrace:
   0:     0x7fdf59d2b0b0 - std::backtrace_rs::backtrace::libunwind::trace::h622bab51c72c4e69
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/../../backtrace/src/backtrace/libunwind.rs:96
   1:     0x7fdf59d2b0b0 - std::backtrace_rs::backtrace::trace_unsynchronized::h7e820b882ebd41ee
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/../../backtrace/src/backtrace/mod.rs:66
   2:     0x7fdf59d2b0b0 - std::sys_common::backtrace::_print_fmt::h64d46258114db92f
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/sys_common/backtrace.rs:79
   3:     0x7fdf59d2b0b0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h47111d0c1b5f0da5
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/sys_common/backtrace.rs:58
   4:     0x7fdf59d9a07c - core::fmt::write::h1857a60b204f1b6a
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/core/src/fmt/mod.rs:1080
   5:     0x7fdf59d1d052 - std::io::Write::write_fmt::h4604516fed3e5731
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/io/mod.rs:1516
   6:     0x7fdf59d2fe7d - std::sys_common::backtrace::_print::h785e7a78d5ef272c
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/sys_common/backtrace.rs:61
   7:     0x7fdf59d2fe7d - std::sys_common::backtrace::print::h108047ac5c4555d5
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/sys_common/backtrace.rs:48
   8:     0x7fdf59d2fe7d - std::panicking::default_hook::{{closure}}::h1d0c271f0d087ebf
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/panicking.rs:208
   9:     0x7fdf59d2fb28 - std::panicking::default_hook::h692753e26f11b7b7
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/panicking.rs:227
  10:     0x7fdf5a5bd3e8 - rustc_driver::report_ice::h767ab601e5f63209
  11:     0x7fdf59d306c6 - std::panicking::rust_panic_with_hook::h74ddc20305301cd9
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/panicking.rs:581
  12:     0x7fdf59d30249 - std::panicking::begin_panic_handler::{{closure}}::h1a9ca6427ceee1d0
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/panicking.rs:484
  13:     0x7fdf59d2b54c - std::sys_common::backtrace::__rust_end_short_backtrace::h97e27b7ab754adde
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/sys_common/backtrace.rs:153
  14:     0x7fdf59d30209 - rust_begin_unwind
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/panicking.rs:483
  15:     0x7fdf59d301bb - std::panicking::begin_panic_fmt::h45d0f154d1dd3395
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/panicking.rs:437
  16:     0x7fdf5d5d9281 - rustc_errors::HandlerInner::flush_delayed::h4e44ea29efc5a508
  17:     0x7fdf5d5d5be1 - <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop::hc2218eb325dc8425
  18:     0x7fdf5a60ad76 - core::ptr::drop_in_place::he652386dc31d9e30
  19:     0x7fdf5a60cbc6 - <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop::h60c7e2432b201062
  20:     0x7fdf5a5e66fd - core::ptr::drop_in_place::h2f4d4236293b18c7
  21:     0x7fdf5a5e0dea - rustc_span::with_source_map::h23e56868796f6dc3
  22:     0x7fdf5a615ed2 - rustc_interface::interface::create_compiler_and_run::h9a8debbb19483b80
  23:     0x7fdf5a5f4d0a - scoped_tls::ScopedKey<T>::set::hacc47b1cdb25a215
  24:     0x7fdf5a618611 - std::sys_common::backtrace::__rust_begin_short_backtrace::h3d5db7946c19f316
  25:     0x7fdf5a59618e - core::ops::function::FnOnce::call_once{{vtable.shim}}::he1a30fa4d30a2178
  26:     0x7fdf59d3efda - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h588ce842808b3fd0
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/alloc/src/boxed.rs:1042
  27:     0x7fdf59d3efda - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h46bc655f05471a92
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/alloc/src/boxed.rs:1042
  28:     0x7fdf59d3efda - std::sys::unix::thread::Thread::new::thread_start::hb4b79d379b730058
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/sys/unix/thread.rs:87
  29:     0x7fdf59c3b3e9 - start_thread
  30:     0x7fdf59b58293 - __GI___clone
  31:                0x0 - <unknown>

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.49.0-nightly (98edd1fbf 2020-10-06) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z mir-opt-level=2

query stack during panic:
end of query stack

</p> </details>

created time in 19 days

issue openedrust-lang/rust

ice with -Zmir-opt-level=2 issue-50865-private-impl-trait/auxiliary/lib.rs

<!-- Thank you for finding an Internal Compiler Error! 🧊 If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples.

http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/

-->

Code

./src/test/ui/issues/issue-50865-private-impl-trait/auxiliary/lib.rs

#![crate_type = "lib"]

pub fn bar<P>( // Error won't happen if "bar" is not generic
    _baz: P,
) {
    hide_foo()();
}

fn hide_foo() -> impl Fn() { // Error won't happen if "iterate" hasn't impl Trait or has generics
    foo
}

fn foo() { // Error won't happen if "foo" isn't used in "iterate" or has generics
}

Meta

<!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. -->

rustc --version --verbose:

rustc 1.49.0-nightly (98edd1fbf 2020-10-06)
binary: rustc
commit-hash: 98edd1fbf8a68977a2a7c1312eb1ebff80515a92
commit-date: 2020-10-06
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly
LLVM version: 11.0

Error output

error: internal compiler error: Encountered error `Unimplemented` selecting `Binder(<impl std::ops::Fn<()> as std::ops::Fn<()>>)` during codegen
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/codegen/mod.rs:65:32

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:961:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.49.0-nightly (98edd1fbf 2020-10-06) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z mir-opt-level=2

<!-- Include a backtrace in the code block by setting RUST_BACKTRACE=1 in your environment. E.g. RUST_BACKTRACE=1 cargo build. --> <details><summary><strong>Backtrace</strong></summary> <p>

error: internal compiler error: Encountered error `Unimplemented` selecting `Binder(<impl std::ops::Fn<()> as std::ops::Fn<()>>)` during codegen
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/codegen/mod.rs:65:32

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:961:13
stack backtrace:
   0:     0x7f0f02a6f0b0 - std::backtrace_rs::backtrace::libunwind::trace::h622bab51c72c4e69
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/../../backtrace/src/backtrace/libunwind.rs:96
   1:     0x7f0f02a6f0b0 - std::backtrace_rs::backtrace::trace_unsynchronized::h7e820b882ebd41ee
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/../../backtrace/src/backtrace/mod.rs:66
   2:     0x7f0f02a6f0b0 - std::sys_common::backtrace::_print_fmt::h64d46258114db92f
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/sys_common/backtrace.rs:79
   3:     0x7f0f02a6f0b0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h47111d0c1b5f0da5
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/sys_common/backtrace.rs:58
   4:     0x7f0f02ade07c - core::fmt::write::h1857a60b204f1b6a
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/core/src/fmt/mod.rs:1080
   5:     0x7f0f02a61052 - std::io::Write::write_fmt::h4604516fed3e5731
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/io/mod.rs:1516
   6:     0x7f0f02a73e7d - std::sys_common::backtrace::_print::h785e7a78d5ef272c
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/sys_common/backtrace.rs:61
   7:     0x7f0f02a73e7d - std::sys_common::backtrace::print::h108047ac5c4555d5
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/sys_common/backtrace.rs:48
   8:     0x7f0f02a73e7d - std::panicking::default_hook::{{closure}}::h1d0c271f0d087ebf
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/panicking.rs:208
   9:     0x7f0f02a73b28 - std::panicking::default_hook::h692753e26f11b7b7
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/panicking.rs:227
  10:     0x7f0f033013e8 - rustc_driver::report_ice::h767ab601e5f63209
  11:     0x7f0f02a746c6 - std::panicking::rust_panic_with_hook::h74ddc20305301cd9
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/panicking.rs:581
  12:     0x7f0f02a74249 - std::panicking::begin_panic_handler::{{closure}}::h1a9ca6427ceee1d0
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/panicking.rs:484
  13:     0x7f0f02a6f54c - std::sys_common::backtrace::__rust_end_short_backtrace::h97e27b7ab754adde
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/sys_common/backtrace.rs:153
  14:     0x7f0f02a74209 - rust_begin_unwind
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/panicking.rs:483
  15:     0x7f0f02a741bb - std::panicking::begin_panic_fmt::h45d0f154d1dd3395
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/panicking.rs:437
  16:     0x7f0f0631d281 - rustc_errors::HandlerInner::flush_delayed::h4e44ea29efc5a508
  17:     0x7f0f06319be1 - <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop::hc2218eb325dc8425
  18:     0x7f0f0334ed76 - core::ptr::drop_in_place::he652386dc31d9e30
  19:     0x7f0f03350bc6 - <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop::h60c7e2432b201062
  20:     0x7f0f0332a6fd - core::ptr::drop_in_place::h2f4d4236293b18c7
  21:     0x7f0f03324dea - rustc_span::with_source_map::h23e56868796f6dc3
  22:     0x7f0f03359ed2 - rustc_interface::interface::create_compiler_and_run::h9a8debbb19483b80
  23:     0x7f0f03338d0a - scoped_tls::ScopedKey<T>::set::hacc47b1cdb25a215
  24:     0x7f0f0335c611 - std::sys_common::backtrace::__rust_begin_short_backtrace::h3d5db7946c19f316
  25:     0x7f0f032da18e - core::ops::function::FnOnce::call_once{{vtable.shim}}::he1a30fa4d30a2178
  26:     0x7f0f02a82fda - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h588ce842808b3fd0
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/alloc/src/boxed.rs:1042
  27:     0x7f0f02a82fda - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h46bc655f05471a92
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/alloc/src/boxed.rs:1042
  28:     0x7f0f02a82fda - std::sys::unix::thread::Thread::new::thread_start::hb4b79d379b730058
                               at /rustc/98edd1fbf8a68977a2a7c1312eb1ebff80515a92/library/std/src/sys/unix/thread.rs:87
  29:     0x7f0f0297f3e9 - start_thread
  30:     0x7f0f0289c293 - __GI___clone
  31:                0x0 - <unknown>

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.49.0-nightly (98edd1fbf 2020-10-06) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z mir-opt-level=2

query stack during panic:
end of query stack

</p> </details>

created time in 19 days

push eventmatthiaskrgr/cargo-cache

Amrit Rathie

commit sha 634f4c64dfbefa10d8c287ed649f2757cddb3a08

Replace dependency dirs with dirs-next

view details

Amrit Rathie

commit sha 3e804acba4967b044e90231ca04141d4f97b86ab

Replace usages of dirs with dirs-next

view details

Amrit Rathie

commit sha 74b74f10a1c80647d4847ff95275c2e56060bb26

Clean up error handling around dirs-next usage

view details

Amrit Rathie

commit sha 0745adef54c73d6c1da9400c94635bf35d2b4480

Use constant instead of runtime variable for cache name

view details

Amrit Rathie

commit sha a6f7d091003ec9a5797bbaeea9ddf904046125af

Reorganize flow of sccache search function This flow more clearly conveys the intention of the function. First, we look for an env variable with the directory. If there isn't one, we look for the default location. If everything fails, we report that we can't find an sccache directory.

view details

Amrit Rathie

commit sha f2553ebec7fa1bd9a7604ac98270b57054ea9ba2

Correct github link on dirs-next dependency

view details

Amrit Rathie

commit sha c2bfb28bd2868b76dad2938ebbb34a913e9146af

Summarize changes in CHANGELOG

view details

Matthias Krüger

commit sha 05e57d36b95fed4df85792ce3a00c50bcf4bd40a

Merge pull request #89 from Spaceface16518/dirs-next Dependency dirs is deprecated; use dirs-next

view details

push time in 19 days

PR merged matthiaskrgr/cargo-cache

Dependency dirs is deprecated; use dirs-next

Change dependency from dirs to dirs-next in manifest files and modify usage of dirs library to use dirs-next library.

The reddit post about the change states that dirs-next is a drop in replacement. I could have just aliased dirs-next to dirs in Cargo.toml, but I actually changed the usage from dirs to dirs-next.

- let mut cache_dir: Option<PathBuf> = dirs::cache_dir();
+ let mut cache_dir: Option<PathBuf> = dirs_next::cache_dir();
+25 -27

3 comments

4 changed files

Spaceface16518

pr closed time in 19 days

PullRequestReviewEvent

Pull request review commentmatthiaskrgr/cargo-cache

Dependency dirs is deprecated; use dirs-next

 cfg-if = { version = "0.1.10" } # if cfg(..)  { ...  } chrono = { version = "0.4.11", optional = true } # compare dates etc  # https://github.com/soc/dirs-rs-dirs = { version = "3.0.1", optional = true } # get cache dirs to look for sccache cache+dirs-next = { version = "1.0.1", optional = true } # get cache dirs to look for sccache cache

The link to the github repo of the project needs to be updated as well.

Spaceface16518

comment created time in 20 days

PullRequestReviewEvent
PullRequestReviewEvent

issue commentmatthiaskrgr/cargo-cache

alt reg: add support to only clean up a single registry

Hi! So, the stuff about the registry indices is inside src/cache. I tried to split up everything so that there is a "Supercache" (this is similar to the ~/.cargo/registry/cache directory) and a "subcache" which represents a single registry (such as ~/.cargo/registry/cache/github.com-1ecc6299db9ec823, the default crates.io registry, or an alternative registry (~/.cargo/registry/cache/dl.cloudsmith.io-0aaaba6a806079f8).

You can find the supercache and subcache traits here: https://github.com/matthiaskrgr/cargo-cache/blob/master/src/cache/caches.rs

All the subcache-structs should have a name field which is derived from the registry-directory name. IIRC it will be "github.com" for the default crates.io registry and dl.cloudsmith.io for my cloudsmith test registry.

For removing only from a specified registry I would add a new --registry= cmdline flag to specify a registry to remove. (this could also be a comma-seperated list of registries to remove, like --registry="github.com,cloudsmith"). Then --autoclean, --autoclean-expensive, --keep-duplicate-crates, --remove-dir, --remove-if-younger/older-thanas well as the clean-unref and the trim subcommands need to be tweaked to touch specified registries if the --registry flag was passed.

The commandline/clap interface is mostly defined here https://github.com/matthiaskrgr/cargo-cache/blob/master/src/cli.rs, most of the conditional logic happens in main.rs though.

The most tricky part will be to find all the places where stuff is being removed (git grep remove_) and add some kind of filter that keeps certain registries alive.

For example --autoclean is implemented here: https://github.com/matthiaskrgr/cargo-cache/blob/master/src/main.rs#L386

currently it just blindly removes ~/.cargo/registry/src and ~/.cargo/git/checkouts. We can ignore the .git repo, but we need to restrict it here to only remove a the specified registry.

the cargo_cache is just a struct holding directory paths, we would actually need the Cache here which is registry_sources_caches variable. We need to bring the SubCache trait into scope and then we can access the registries one by one via registry_sources_caches.caches().iter().for_each(|x| println!("{}", x.name())); (the .caches() returns a vec of Paths, each path is the directory of a subcache aka a registry.) This will print the names of each registry that is found. You can add .filter() to only match wanted registries and the pass these along for removal: Concept diff:

diff --git a/src/main.rs b/src/main.rs
index 1329460..9c1f7da 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -74,6 +74,7 @@ cfg_if::cfg_if! {

         // use
         use crate::cache::caches::{Cache, RegistrySuperCache};
+        use crate::cache::caches::RegistrySubCache;
         use clap::value_t;
         use std::process;
         use std::time::SystemTime;
@@ -384,26 +385,28 @@ fn main() {
     }

     if config.is_present("autoclean") || config.is_present("autoclean-expensive") {
-        // clean the registry sources and git checkouts
-        let reg_srcs = &cargo_cache.registry_sources;
+        // clean the registry sources and git checkoutsname
+        //  let reg_srcs  = &cargo_cache.registry_sources;
         let git_checkouts = &cargo_cache.git_checkouts;

+        // collect the registries to remove,
+        let mut paths_to_be_removed: Vec<&std::path::PathBuf> = registry_sources_caches
+            .caches()
+            .iter()
+            /*.filter( only match wanted registries )*/
+            .map(|subcache| subcache.path())
+            .collect();
+
+        paths_to_be_removed.push(git_checkouts);
+
         // depending on the size of the cache and the system (SSD, HDD...) this can take a few seconds.
         println!("\nClearing cache...");

-        for dir in &[reg_srcs, git_checkouts] {
-            let size = cumulative_dir_size(dir);
-            if dir.is_dir() {
-                remove_file(
-                    dir,
-                    config.is_present("dry-run"),
-                    &mut size_changed,
-                    None,
-                    &DryRunMessage::Default,
-                    Some(size.dir_size),
-                );
-            }
+        for dir in paths_to_be_removed {
+            println!("removing: {:?}", dir.display());
+            /* remove */
         }
+        return;
     }

     if config.is_present("keep-duplicate-crates") {

It would make sense to also have a command which lists all registries and their names cargo cache --list-registries? at some point. Oh and currently the function that tries to figure out the name of a cache/registry removes the hash from the git repo (git grep "fn get_cache_name"). In order to disambiguate between different registries on the same host, it should probably be modified to not throw away the hash.

I hope this helps and is not too confusing, feel free to bombard me with questions. :sweat_smile: :D

matthiaskrgr

comment created time in 25 days

pull request commentrust-lang/rust-clippy

New Lint: disallowed_method

Thanks! @bors r+

ilknarf

comment created time in a month

PullRequestReviewEvent

pull request commentrust-lang/rust-clippy

Remove rustfmt bug workaround

Hmm, it seems the rustfmt commit 5e667d326f929a0770c1e56cd0a921dfb16400e2 has not yet landed inside the rustfmt submodule of the rustc repo.

mikerite

comment created time in a month

pull request commentrust-lang/rust-clippy

Remove rustfmt bug workaround

Argh, apparently editing a comment that contains @bors try will retrigger bors, sorry :/

mikerite

comment created time in a month

Pull request review commentrust-lang/rust-clippy

New Lint: disallowed_method

+use crate::utils::span_lint;++use rustc_data_structures::fx::FxHashSet;+use rustc_hir::{Expr, ExprKind};+use rustc_lint::{LateContext, LateLintPass};+use rustc_session::{declare_tool_lint, impl_lint_pass};+use rustc_span::Symbol;++declare_clippy_lint! {+    /// **What it does:** Lints for specific trait methods defined in clippy.toml+    ///+    /// **Why is this bad?** Some methods are undesirable in certain contexts,+    /// and it would be beneficial to lint for them as needed.+    ///+    /// **Known problems:** None.+    ///+    /// **Example:**+    ///+    /// ```rust,ignore+    /// // example code where clippy issues a warning+    /// foo.bad_method(); // Foo is disallowed+    /// ```+    /// Use instead:+    /// ```rust,ignore+    /// // example code which does not raise clippy warning+    /// goodStruct.bad_method(); // not disallowed+    /// ```+    pub DISALLOWED_METHOD,+    nursery,+    "used disallowed method call"+}++#[derive(Clone, Debug)]+pub struct DisallowedMethod {+    disallowed: FxHashSet<Vec<Symbol>>,+}++impl DisallowedMethod {+    pub fn new(disallowed: &FxHashSet<String>) -> Self {+        Self {+            disallowed: disallowed+                .iter()+                .map(|s| s.split("::").map(|seg| Symbol::intern(seg)).collect::<Vec<_>>())+                .collect(),+        }+    }+}++impl_lint_pass!(DisallowedMethod => [DISALLOWED_METHOD]);++impl<'tcx> LateLintPass<'tcx> for DisallowedMethod {+    fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {+        if let ExprKind::MethodCall(_path, _, _args, _) = &expr.kind {+            let def_id = cx.typeck_results().type_dependent_def_id(expr.hir_id).unwrap();++            let method_call = cx.get_def_path(def_id);+            if self.disallowed.contains(&method_call) {+                span_lint(+                    cx,+                    DISALLOWED_METHOD,+                    expr.span,+                    &format!(+                        "Use of a disallowed method `{}`",+                        method_call+                            .iter()+                            .map(|s| s.to_ident_string())+                            .collect::<Vec<_>>()+                            .join("::"),

Making this a variable and using the var inside the format!() is clearer imo.

ilknarf

comment created time in a month

Pull request review commentrust-lang/rust-clippy

New Lint: disallowed_method

+use crate::utils::span_lint;++use rustc_data_structures::fx::FxHashSet;+use rustc_hir::{Expr, ExprKind};+use rustc_lint::{LateContext, LateLintPass};+use rustc_session::{declare_tool_lint, impl_lint_pass};+use rustc_span::Symbol;++declare_clippy_lint! {+    /// **What it does:** Lints for specific trait methods defined in clippy.toml+    ///+    /// **Why is this bad?** Some methods are undesirable in certain contexts,+    /// and it would be beneficial to lint for them as needed.+    ///+    /// **Known problems:** None.+    ///+    /// **Example:**+    ///+    /// ```rust,ignore+    /// // example code where clippy issues a warning+    /// foo.bad_method(); // Foo is disallowed+    /// ```+    /// Use instead:+    /// ```rust,ignore+    /// // example code which does not raise clippy warning+    /// goodStruct.bad_method(); // not disallowed+    /// ```+    pub DISALLOWED_METHOD,+    nursery,+    "used disallowed method call"

This could be the same as the lint message: "use of disallowed method call"

ilknarf

comment created time in a month

Pull request review commentrust-lang/rust-clippy

New Lint: disallowed_method

+use crate::utils::span_lint;++use rustc_data_structures::fx::FxHashSet;+use rustc_hir::{Expr, ExprKind};+use rustc_lint::{LateContext, LateLintPass};+use rustc_session::{declare_tool_lint, impl_lint_pass};+use rustc_span::Symbol;++declare_clippy_lint! {+    /// **What it does:** Lints for specific trait methods defined in clippy.toml+    ///+    /// **Why is this bad?** Some methods are undesirable in certain contexts,+    /// and it would be beneficial to lint for them as needed.+    ///+    /// **Known problems:** None.+    ///+    /// **Example:**+    ///+    /// ```rust,ignore+    /// // example code where clippy issues a warning+    /// foo.bad_method(); // Foo is disallowed+    /// ```+    /// Use instead:+    /// ```rust,ignore+    /// // example code which does not raise clippy warning+    /// goodStruct.bad_method(); // not disallowed+    /// ```+    pub DISALLOWED_METHOD,+    nursery,+    "used disallowed method call"+}++#[derive(Clone, Debug)]+pub struct DisallowedMethod {+    disallowed: FxHashSet<Vec<Symbol>>,+}++impl DisallowedMethod {+    pub fn new(disallowed: &FxHashSet<String>) -> Self {+        Self {+            disallowed: disallowed+                .iter()+                .map(|s| s.split("::").map(|seg| Symbol::intern(seg)).collect::<Vec<_>>())+                .collect(),+        }+    }+}++impl_lint_pass!(DisallowedMethod => [DISALLOWED_METHOD]);++impl<'tcx> LateLintPass<'tcx> for DisallowedMethod {+    fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {+        if let ExprKind::MethodCall(_path, _, _args, _) = &expr.kind {+            let def_id = cx.typeck_results().type_dependent_def_id(expr.hir_id).unwrap();++            let method_call = cx.get_def_path(def_id);+            if self.disallowed.contains(&method_call) {+                span_lint(+                    cx,+                    DISALLOWED_METHOD,+                    expr.span,+                    &format!(+                        "Use of a disallowed method `{}`",

lint messages should not be capitalized

ilknarf

comment created time in a month

PullRequestReviewEvent
PullRequestReviewEvent

pull request commentrust-lang/rust-clippy

Remove rustfmt bug workaround

I bors will try on windows, too? @bors try

mikerite

comment created time in a month

push eventmatthiaskrgr/rust-clippy

Matthias Krüger

commit sha d3b2c67c5d0c1c883929e635c04025056cbb4102

single_char_push_str lint using insert_str() on single-char literals and suggest insert() changelog: single_char_push_str: lint using string.insert_str() with single char literals and suggests string.insert() with a char Fixes #6026

view details

Matthias Krüger

commit sha c9050a9867fbbd6c601e3cf2036527015de5b728

handle macros returning Strings in single_char_push_str and single_char_insert_str

view details

Matthias Krüger

commit sha 956a847260fd588bcd7209d0cdffa2f2496f3a84

get_hint_if_single_char_arg: fix bug where multi-char letters are not detected properly

view details

push time in a month

push eventmatthiaskrgr/rust-clippy

Ricky

commit sha e49a29933be3bd988ccb75b053f480d9c99a7ff5

Working map_err_ignore lint

view details

Ricky

commit sha 202a80c927412a548180eca5990ee764d76ed643

Added tests for map_err, ignored map_err lint on drop_ref tests

view details

Ricky

commit sha 337729137bdec31b55665653ef0cf7dc124b0eaa

Ran cargo dev update_lints

view details

Ricky

commit sha 2387f68e437bf2ff5f117f63936257ce64052cfa

Removed map_err suggestion in lint, and updated lint documentation example

view details

Jane Lusby

commit sha c31d4730b0d40c62934839405d0c25e2ffa3fad1

update example to be more idiomatic

view details

Ricky

commit sha 4f1c4a99d4d98f1acea3c9c7cc55355aa46119aa

Fixed typo in lint and test

view details

Ricky

commit sha d719b485434eac557e65bf55cca79e63f7b83d5b

Move map_err_ignore from style to pedantic

view details

Thom Chiovoloni

commit sha 6211599ccafee5b2429bfb1bbeb48ead32a48484

Extend invalid_atomic_ordering to detect misuse of compare_exchange{,_weak}

view details

Thom Chiovoloni

commit sha 61671a2268903e1b5c28fcb3c713c27e84ea3e9b

Detect fetch_update misuse in invalid_atomic_ordering too

view details

Thom Chiovoloni

commit sha 159178e5d4a023f3945b504b49d3742b40453fee

Separate compare_exchange and compare_exchange_weak uitests

view details

Thom Chiovoloni

commit sha b65745545f410b31c5ecdd33a8299a65da578af2

Use AtomicU8 in ordering example so all operations can be demonstrated

view details

Thom Chiovoloni

commit sha 4b5326b0d62104801f0b33c4d8f3749d93eebc02

Address small review comments

view details

Thom Chiovoloni

commit sha 3a072131da2e574e914073af6d72360ead735781

Ah, right, rerun the scripts

view details

Thom Chiovoloni

commit sha 09f7a377a663043c6f63ded70436ac0969e4abc7

Add comments to the invalid_atomic_ordering example

view details

Michael Wright

commit sha d1f0f04a488d027fdf91e08cdf25df00fb677205

New lint: `manual-strip` Add a new lint, `manual-strip`, that suggests using the `str::strip_prefix` and `str::strip_suffix` methods introduced in Rust 1.45 when the same functionality is performed 'manually'. Closes #5734

view details

Michael Wright

commit sha 15244a88df5cfd475df010ad945474c658749192

Fix `manual-strip` dogfood errors

view details

bors

commit sha f82e84c8943e70300ad1f4de46d8d7bd889c6bde

Auto merge of #5998 - deg4uss3r:master, r=yaahc Add map_err_ignore lint In a large code base a lot of times errors are ignored by using something like: ```rust foo.map_err(|_| Some::Enum)?; ``` This drops the original error in favor of a enum that will not have the original error's context. This lint helps catch throwing away the original error in favor of an enum without its context. --- *Please keep the line below* changelog: Added map_err_ignore lint

view details

Robin Schoonover

commit sha 1b5317f68b2b55803d5051e9945f9a33817fccef

Add rc_buffer lint for Rc<String> and other buffer types

view details

Robin Schoonover

commit sha 2dd7175d60e070c7ee2b4609bdb17eae16e381f0

Apply rc_buffer lint to Arc<T>

view details

Haraman Johal

commit sha 4d73ccaa9419b393b9c94f977ec0e158897feeb3

clarify margin of error in wording of float comparison operator lint messages

view details

push time in a month

Pull request review commentrust-lang/rust-clippy

single_char_insert_str: lint using insert_str() on single-char literals and suggest insert()

 fn main() {     string.push('\x52');     string.push('\u{0052}');     string.push('a');++    get_string!().push_str("ö");

Ah good point! I added the fix.

matthiaskrgr

comment created time in a month

PullRequestReviewEvent

pull request commentrust-lang/rust-clippy

Revert: or_fun_call should lint calls to `const fn`s with no args

How urgent is this, should this be included in https://github.com/rust-lang/rust/pull/77144 ? (pr was not approved yet)

ebroto

comment created time in a month

pull request commentrust-lang/rust-clippy

Revert: or_fun_call should lint calls to `const fn`s with no args

Ok :+1:

@bors r+

ebroto

comment created time in a month

pull request commentrust-lang/rust-clippy

Revert: or_fun_call should lint calls to `const fn`s with no args

Just making sure I understood correctly; The changes that are being reverted here were based on the assumption that const fns were always evaluated at compiletime BUT this is wrong because they are only evaluated at compile time if called from a const context (such as const var bindings)?

ebroto

comment created time in a month

pull request commentrust-lang/rust-clippy

Fix a FP in `explicit_counter_loop`

Thanks! @bors r+

rail-rain

comment created time in a month

pull request commentrust-lang/rust

more tiny clippy cleanups

@rustbot modify labels: +S-waiting-on-review -S-waiting-on-author

matthiaskrgr

comment created time in a month

push eventmatthiaskrgr/rust

Simon Vandel Sillesen

commit sha e5447a22222ecc6a650e75282cb9931b910854b2

Fix #76432 Only insert StorageDeads if we actually removed one. Fixes an issue where we added StorageDead to a place with no StorageLive

view details

Manish Goregaokar

commit sha c100e726c10fe9d212a58a5494126409e7d0e10b

Stabilize intra-doc links

view details

Manish Goregaokar

commit sha 63d5beec43ff7721928821cd83f9790188b03276

Move intra-doc-links documentation out of unstable section

view details

Manish Goregaokar

commit sha bc06674774e6457046e41a48dc3e8be8c5496f11

Mention super/crate/self in docs

view details

Manish Goregaokar

commit sha f072e4a7322e8e2b16410e3225e1afc15d132e36

Mention URL fragments

view details

Manish Goregaokar

commit sha 2a98409634ec38547d03512898192b5bdce15f3d

Fill out docs on intra-doc resolution failure lint

view details

Manish Goregaokar

commit sha 4e0eb0b73ba2defaf0f3c2152e9daa5c18d1603f

Update src/doc/rustdoc/src/linking-to-items-by-name.md Co-authored-by: Joshua Nelson <joshua@yottadb.com>

view details

Manish Goregaokar

commit sha 175e30539d5ee9364a26f89f8a03a60b53690684

Update src/doc/rustdoc/src/linking-to-items-by-name.md Co-authored-by: Joshua Nelson <joshua@yottadb.com>

view details

Manish Goregaokar

commit sha 51c1351f7b9366a295dce5d63c2fd387170d5c34

Resolve some conflicts

view details

Manish Goregaokar

commit sha 6f1fa2b16376f586285453045788519df527a1b2

Fix lint name in docs

view details

Manish Goregaokar

commit sha 792b2ea5812a06fe3d362ae36025998af66199ee

Update src/doc/rustdoc/src/lints.md Co-authored-by: Joshua Nelson <joshua@yottadb.com>

view details

Tomasz Miąsko

commit sha ff1a9e406bfccefedb6c4f2cabc0c4d59ac947d4

Fix underflow when calculating the number of no-op jumps folded When removing unwinds to no-op blocks and folding jumps to no-op blocks, remove the unwind target first. Otherwise we cannot determine if target has been already folded or not. Previous implementation incorrectly assumed that all resume targets had been folded already, occasionally resulting in an underflow: remove_noop_landing_pads: removed 18446744073709551613 jumps and 3 landing pads

view details

Manish Goregaokar

commit sha 6928041c0a992093a7752ae3c04090caebcd4515

Update src/doc/rustdoc/src/linking-to-items-by-name.md Co-authored-by: Joshua Nelson <joshua@yottadb.com>

view details

est31

commit sha f05b47ccdfa63f8b4b9fb47a9aa92381801d3ff1

Don't download/sync llvm-project submodule if download-ci-llvm is set llvm-project takes > 1GB storage space and a long time to download. It's better to not download it unless needed.

view details

Bastian Kauschke

commit sha 1146c39da74b3875e6667aeeafde2773644dc8b6

cache types during normalization

view details

Bastian Kauschke

commit sha d4039c55c9ef392261aeaba6c14ae81f5098139a

wip emit errors during AbstractConst building

view details

Bastian Kauschke

commit sha 30cbc9729654c66b9f54779d18f023e47112cdf2

words

view details

Mark Rousskov

commit sha 389b7ff19074988a3855bbc5ba7b19eb903a6fb4

Do not link LLVM tools to LLVM dylib unless rustc is Previously we would have some platforms where LLVM was linked to rustc statically, but to the LLVM tools dynamically. That meant we were distributing two copies of LLVM: one as a separate dylib and one statically linked in to librustc_driver.

view details

yuk1ty

commit sha 16047d46a10813a25e956e659b8861cc67c20cd2

fix typo in docs and comments

view details

Mara Bos

commit sha db74e1f1e3e5c7497bb9af68814497c8df1fd0b8

Add cfg(target_has_atomic_equal_alignment). This is needed for Atomic::from_mut.

view details

push time in a month

PR opened rust-lang/rust

clarify that `changelog-seen = 1` goes to the beginning of config.toml

Fixes #77105

+1 -1

0 comment

1 changed file

pr created time in a month

create barnchmatthiaskrgr/rust

branch : changelog_seen

created branch time in a month

issue commentrust-lang/rust

rustbuild: "changelog-seen = 1" breaks config.toml

Apparently the script wants it at the beginning of the toml file, the warning message should says so :roll_eyes:

matthiaskrgr

comment created time in a month

issue openedrust-lang/rust

rustbuild: "changelog-seen = 1" breaks config.toml

warning: x.py has made several changes recently you may want to look at
help: consider looking at the changes in `src/bootstrap/CHANGELOG.md`
note: to silence this warning, add `changelog-seen = 1` to `config.toml`

So I skipped through the changelog and added changelog-seen = 1 to the end of my config toml but this broke x.py:

failed to parse TOML configuration 'config.toml': unknown fieldchangelog-seen, expected one ofsign-folder,gpg-password-file,upload-addr,src-tarball,missing-toolsfor keydistat line 522 column 1

created time in a month

issue commentrust-lang/rust

llvm segfaults during bootstrap of rustc_middle in stage 1

Still crashes after llvm update in https://github.com/rust-lang/rust/pull/77063

matthiaskrgr

comment created time in a month

Pull request review commentrust-lang/rust

more tiny clippy cleanups

 impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {         let res = match bin_op {             Eq => l == r,             Ne => l != r,-            Lt => l < r,+            Lt => !l & r, // equals l < r

Alright, I removed changes from the pr. Sprinkling the rustc code with clippy allow attributes is probably something most people would object though.

matthiaskrgr

comment created time in a month

PullRequestReviewEvent

push eventmatthiaskrgr/rust

Federico Ponzi

commit sha 27c90b881df93b53fd3f24dcbfed116379c2fc69

initial implementation of OpenOptions to c_int

view details

Federico Ponzi

commit sha eb3906be4ad375cc6b83cd6a6e0116817db22575

Fix typo get openoptions function name Co-authored-by: Ivan Tham <pickfire@riseup.net>

view details

Federico Ponzi

commit sha 1bc0627607262cc60a7692b16e205f30fc88b89f

Add as_flag function to the OpenOptionsExt struct

view details

Federico Ponzi

commit sha 2c9e27b759a9e9feeb943fb855e32d7383d1dcc6

Merge branch 'convert-openoptions-cint' of github.com:FedericoPonzi/rust into convert-openoptions-cint

view details

Federico Ponzi

commit sha 7c1e5c1dcd25c945f619eda289f639dbe2b002da

Update OpenOptions::as_flags docs, and minor styling

view details

Federico Ponzi

commit sha 321b680fe66d1be04cd67fac75ff7f148fd117fe

Update docs of OpenOptions::as_flags

view details

Federico Ponzi

commit sha 70292d45060ee2b8829e2af0be54d5a76696cd1d

Sets as_flags as unstable

view details

Nicholas-Baron

commit sha 63dbfb3c30c96449eb1e0236b4f6fa5d60bdf609

Start of moving some functionality to separate files

view details

Nicholas-Baron

commit sha bfe5bc9cb93445c7e2818db684de2bf1d84a06c7

Formatter moved one use statement

view details

Nicholas-Baron

commit sha 6fd80e35e03f0acf48c065d6682600d32b27915f

Moved another struct and used pub(super) to be explicit

view details

Nicholas-Baron

commit sha 3e770645aade4b7e34898a9f102bd5e4d5589f32

Moved a struct only need by util into util

view details

Nicholas-Baron

commit sha c190f66060ee3ae4aa84a1c291b3a95ce77e6dc8

Moved GatherLocalsVisitor to its own file

view details

Nicholas-Baron

commit sha c8162c22ebce04a7a70739cb09b913ee162c4d0a

Moved the FnCtxt struct to its own file

view details

Nicholas-Baron

commit sha 45fdf97d1131324b32510ab012825ccf600e947a

Removed util.rs Per suggestion of @oli-obk. This file was rather short and joining it did not cause mod.rs to become significantly bigger.

view details

Nicholas-Baron

commit sha 7995d5cda4cd5154def40770f4527e7867f37c1a

Moved Inherited struct to own file

view details

Nicholas-Baron

commit sha b1e93796797624f33ea4f0f8563d002f28234d7d

Formatted use statements for fewer lines

view details

Nicholas-Baron

commit sha 428a8c6eae7eadc08e8048929050818829ea7b4d

Moved the Diverges struct to its own file

view details

Nicholas-Baron

commit sha f896ddfc737d9ba9be22f60e8194986a6dc589ad

Moved the Expectation enum to its own file

view details

Nicholas-Baron

commit sha 99e2e7075c0e32644498dd0bb64aae9a76ecfbce

Moved all functions prefixed with 'check' to a separate file

view details

Joshua Nelson

commit sha fe6fc555acd51bd7ba8755d9fbc7060feb67be25

Add a changelog for x.py - Add a changelog and instructions for updating it - Use `changelog-seen` in `config.toml` and `VERSION` in bootstrap to determine whether the changelog has been read - Nag people if they haven't read the x.py changelog + Print message twice to make sure it's seen - Give different error messages depending on whether the version needs to be updated or added

view details

push time in a month

pull request commentrust-lang/rust-clippy

Fix a FP in `explicit_counter_loop`

Shouldn't we keep some tests where the counters are incremented at the start of the loop?

rail-rain

comment created time in a month

Pull request review commentrust-lang/rust

more tiny clippy cleanups

 impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {         let res = match bin_op {             Eq => l == r,             Ne => l != r,-            Lt => l < r,+            Lt => !l & r, // equals l < r             Le => l <= r,-            Gt => l > r,+            Gt => l & !r, // equals l > r

Hm. To me true & !false is easier to understand than true > false.

matthiaskrgr

comment created time in a month

PullRequestReviewEvent

push eventmatthiaskrgr/rust

Ivan Tham

commit sha c5975e9b6c5781b3b7300b7921c14b060086e1c1

Reduce duplicate in liballoc reserve error handling

view details

Federico Ponzi

commit sha 28db5214d2c48e7a58cf79b9e272097260910a33

More implementations of Write for immutable refs Fixes #73836

view details

Federico Ponzi

commit sha ec7f9b927f1896c7f29c602d6b0f961c891d0941

Deduplicates io::Write implementations

view details

Christiaan Dirkx

commit sha 8f27e3cb1b4140d9124d60df0850ef734e73b884

Make some methods of `Pin` unstable const Make the following methods unstable const under the `const_pin` feature: - `new` - `new_unchecked` - `into_inner` - `into_inner_unchecked` - `get_ref` - `into_ref` Also adds tests for these methods in a const context. Tracking issue: #76654

view details

Lzu Tao

commit sha eede953c283c7bbe903a0e8abb44c923baf5cfac

Only get ImplKind::Impl once

view details

Dylan MacKenzie

commit sha ed6c7efd87f17a7d9282f4bc7341cb5cbda8db4d

Use enum for status of non-const ops

view details

Dylan MacKenzie

commit sha c3607bd7dd323a898b8cc9d2c603dfd14172c73c

Use helper function for searching `allow_internal_unstable`

view details

Dylan MacKenzie

commit sha e4edc161f20ccbc77fffb7ceb60ebb6102cbd747

Give name to extra `Span` in `LiveDrop` error

view details

Dylan MacKenzie

commit sha 81b3b66487c7001a0dbadf7f9af41ad714702533

Error if an unstable const eval feature is used in a stable const fn

view details

Dylan MacKenzie

commit sha 1e1257b8f87d1e3073020df27765dc57fcf2c0cd

Bless `miri-unleashed` tests `const_mut_refs` doesn't actually work in a `const` or `static`

view details

Dylan MacKenzie

commit sha abc71677da866fd36c70790e768f36d2f809c493

Test that `const_precise_live_drops` can't be depended upon stably

view details

Mark Rousskov

commit sha 7e24136996fd412ba2890952d5f0ddffb3cb7370

Pass --target to lint docs Otherwise, we may not have a standard library built for the native "host" target of the rustc being run.

view details

Mark Rousskov

commit sha bd4e0af0b54afc91903c282740e25ee6135224c8

Build rustdoc for cross-compiled targets This isn't an issue for most folks who use x.py dist, which will directly depend on this. But for x.py build, if we don't properly set target here rustdoc will not be built. Currently, there is not a default-on step for generating a rustc for a given target either, so we will fail to build a rustc as well.

view details

Mark Rousskov

commit sha 363aff0a9d0b85285b7501cb04dd8263d29d273a

Add test for x.py build cross-compilation

view details

Christiaan Dirkx

commit sha e3c6e46168758642f0bab64da374f93ed21b1cd0

Make some methods of `Pin<&mut T>` unstable const Make the following methods unstable const under the `const_pin` feature: - `into_ref` - `get_mut` - `get_unchecked_mut`

view details

Bastian Kauschke

commit sha f7d5080ec3c21c5418649a1c5b3f830ff37734f1

don't take `TyCtxt` by reference

view details

Bastian Kauschke

commit sha a219ad64a6ee025b9a5c83de390280f818cd81c6

extend `is_ty_or_ty_ctxt` to self types

view details

Bastian Kauschke

commit sha 67f319c30bed5c83ae3b4872109999a8a574f29e

take `TyCtxt` by value

view details

Bastian Kauschke

commit sha 2a00dda90258576e3adf5ecae0437a8fe6fadbcf

miri: correctly deal with `ConstKind::Bound`

view details

Bastian Kauschke

commit sha 67342304253d8af47fe4453fbe2396b627620431

do not ICE on `ty::Bound` in Layout::compute

view details

push time in a month

issue openedrust-lang/rust-clippy

FP explicit_counter_loop: var incremented before usage

<!-- Thank you for filing a bug report! 🐛 Please provide a short summary of the bug, along with any information you feel relevant to replicating the bug. -->

I tried this code:

pub fn main() {
    let mut i = 0;
    let v = vec!["a", "b", "c"];
    for x in &v {
        i += 1;
        println!("{}", i)
    }
}

explicit_counter_loop will trigger here and suggest to use .iter().enumerate(). The problem is that we increment BEFORE using (and not at the end of the loop) so the first iteration will print 1 and not 0 as it would with .enumerate(). This newly suggested code is off by one as can be seen here:

pub fn main() {
    let mut i = 0;
    let v = vec!["a", "b", "c"];
    for (x, _) in v.iter().enumerate() {
        i += 1;
        println!("i is {} but x is {}", i, x)
    }
}
i is 1 but x is 0
i is 2 but x is 1
i is 3 but x is 2

clippy 0.0.212 (fb1dc34 2020-09-21)

created time in a month

Pull request review commentrust-lang/rust

more tiny clippy cleanups

 impl<'a> State<'a> {     {         self.rbox(0, b);         let len = elts.len();-        let mut i = 0;-        for elt in elts {+        for (i, elt) in elts.iter().enumerate() {             self.maybe_print_comment(get_span(elt).hi());             op(self, elt);-            i += 1;             if i < len {                 self.s.word(",");                 self.maybe_print_trailing_comment(get_span(elt), Some(get_span(&elts[i]).hi()));

oh right! Thanks.

matthiaskrgr

comment created time in a month

PullRequestReviewEvent

Pull request review commentrust-lang/rust

more tiny clippy cleanups

 impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {         let res = match bin_op {             Eq => l == r,             Ne => l != r,-            Lt => l < r,+            Lt => !l & r, // equals l < r             Le => l <= r,-            Gt => l > r,+            Gt => l & !r, // equals l > r

The assembly is the same, (one of the functions even gets removed in the example because its identical to the other one) https://godbolt.org/z/czfczr

matthiaskrgr

comment created time in a month

PullRequestReviewEvent

PR opened rust-lang/rust

more tiny clippy cleanups

commits stand alone and can be reviewed one by one

+9 -16

0 comment

7 changed files

pr created time in a month

create barnchmatthiaskrgr/rust

branch : cl42ppy

created branch time in a month

issue openedrust-lang/rust-clippy

FP mut_range_bound: range bound modified inside enclosing loop

In this code we first create the mut range bound, and mutate it in another loop which means the loop that actually uses the range is executed several times with different bounds (even if it is true that inside the usage of the range, changing the index has no effect on the inner loop.

fn main() {
    let mut i = 3;
    while i < 1000 { // this invalidates the lint warning
        for x in i..9 { // this will be unaffected by the i+=4 but we modify i AND LOOP AGAIN!
            i += 4; // lint warns about this
        }

        if i > 12 {
            return;
        }
    }
}

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=30343889f1b8be663adb15c2d8184c2a

The lint should probably only fire if range bound variable and the range bounds usage are in the same scope?

Meta

clippy 0.0.212 (1fd5b9d 2020-09-20)

created time in a month

issue commentrust-lang/rust-clippy

Use rust-project.json instead of patching Cargo.toml

Hm, right now, ra is broke for me anyway, see https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Fixing.20sysroot.20loading

ragne

comment created time in a month

issue commentrust-lang/rust-clippy

Use rust-project.json instead of patching Cargo.toml

Mhh, it seems that 76856 did not help, RA does not automatically find rustc sources in clippy, at least when I tried. cc https://github.com/rust-analyzer/rust-analyzer/issues/3517 I found compiler sources at ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/rustc-src/rust/compiler.

We could perhaps use that (and use master toolchain sources) instead of some kind of path to a local repo at least...

ragne

comment created time in a month

pull request commentrust-lang/rust-clippy

single_char_insert_str: lint using insert_str() on single-char literals and suggest insert()

I made it a separate lint because this way users could disable push_str and insert_str independently but it's probably better to just make it one lint since the patterns are so similar.

matthiaskrgr

comment created time in a month

pull request commentrust-lang/rust

make replace_prefix only take &str as arguments

ah, well I did include the other pr in this one to avoid merge conflicts later down the road

matthiaskrgr

comment created time in a month

pull request commentrust-lang/rust

make replace_prefix only take &str as arguments

r? @lcnr

matthiaskrgr

comment created time in a month

pull request commentrust-lang/rust

use if let instead of single match arm expressions

r? @Dylan-DPC

matthiaskrgr

comment created time in a month

issue commentrust-lang/rust

ICE resolving non-existent PartialEq::Eq from match of const

Still crashing (obviously on nightly, beta and stable by now...).

warning: variant is never constructed: `Some`
 --> src/main.rs:5:5
  |
5 |     Some(*const T), // Can also use PhantomData<T>
  |     ^^^^^^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: Error finalizing incremental compilation session directory `/tmp/a/target/debug/incremental/a-3ibewktm5f4s7/s-frdnn34p4t-5wozmt-working`: No such file or directory (os error 2)

warning: 2 warnings emitted

error: internal compiler error: broken MIR in DefId(0:6 ~ a[e6bb]::foo[0]) (NoSolution): could not prove TraitPredicate(<[O<B>] as std::cmp::PartialEq>)
  |
  = note: delayed at compiler/rustc_mir/src/borrow_check/type_check/mod.rs:258:27

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:961:13
stack backtrace:
   0:     0x7fb253922b30 - std::backtrace_rs::backtrace::libunwind::trace::he85dfb3ae4206056
                               at /rustc/f68e08933d8f519a9655934fedebbc509661b219/library/std/src/../../backtrace/src/backtrace/libunwind.rs:96
   1:     0x7fb253922b30 - std::backtrace_rs::backtrace::trace_unsynchronized::h1ad28094d7b00c21
                               at /rustc/f68e08933d8f519a9655934fedebbc509661b219/library/std/src/../../backtrace/src/backtrace/mod.rs:66
   2:     0x7fb253922b30 - std::sys_common::backtrace::_print_fmt::h901b54610713cd21
                               at /rustc/f68e08933d8f519a9655934fedebbc509661b219/library/std/src/sys_common/backtrace.rs:79
   3:     0x7fb253922b30 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb0ad78ee1571f7e0
                               at /rustc/f68e08933d8f519a9655934fedebbc509661b219/library/std/src/sys_common/backtrace.rs:58
   4:     0x7fb253990e7c - core::fmt::write::h1857a60b204f1b6a
                               at /rustc/f68e08933d8f519a9655934fedebbc509661b219/library/core/src/fmt/mod.rs:1080
   5:     0x7fb253914f07 - std::io::Write::write_fmt::hf7b7d7b243f84a36
                               at /rustc/f68e08933d8f519a9655934fedebbc509661b219/library/std/src/io/mod.rs:1517
   6:     0x7fb253927880 - std::sys_common::backtrace::_print::hd093978a5287b8ff
                               at /rustc/f68e08933d8f519a9655934fedebbc509661b219/library/std/src/sys_common/backtrace.rs:61
   7:     0x7fb253927880 - std::sys_common::backtrace::print::h20f46787581d56d7
                               at /rustc/f68e08933d8f519a9655934fedebbc509661b219/library/std/src/sys_common/backtrace.rs:48
   8:     0x7fb253927880 - std::panicking::default_hook::{{closure}}::h486cbb4b82ffc357
                               at /rustc/f68e08933d8f519a9655934fedebbc509661b219/library/std/src/panicking.rs:208
   9:     0x7fb253927538 - std::panicking::default_hook::h4190c9e3edd4d591
                               at /rustc/f68e08933d8f519a9655934fedebbc509661b219/library/std/src/panicking.rs:227
  10:     0x7fb2541bb8d4 - rustc_driver::report_ice::h0baa69c9fa359ad1
  11:     0x7fb2539280b6 - std::panicking::rust_panic_with_hook::h72e78719cdda225c
                               at /rustc/f68e08933d8f519a9655934fedebbc509661b219/library/std/src/panicking.rs:581
  12:     0x7fb253927c39 - std::panicking::begin_panic_handler::{{closure}}::h8bd07dbd34150a96
                               at /rustc/f68e08933d8f519a9655934fedebbc509661b219/library/std/src/panicking.rs:484
  13:     0x7fb253922fbc - std::sys_common::backtrace::__rust_end_short_backtrace::hdb6b3066ad29028a
                               at /rustc/f68e08933d8f519a9655934fedebbc509661b219/library/std/src/sys_common/backtrace.rs:153
  14:     0x7fb253927bf9 - rust_begin_unwind
                               at /rustc/f68e08933d8f519a9655934fedebbc509661b219/library/std/src/panicking.rs:483
  15:     0x7fb253927bab - std::panicking::begin_panic_fmt::hc19e75fd2b7bc39b
                               at /rustc/f68e08933d8f519a9655934fedebbc509661b219/library/std/src/panicking.rs:437
  16:     0x7fb2572fd471 - rustc_errors::HandlerInner::flush_delayed::hc01570dc9a0301e8
  17:     0x7fb2572f9dd1 - <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop::h2fa2449267c97abc
  18:     0x7fb2541df306 - core::ptr::drop_in_place::h3ccf454d686c35e3
  19:     0x7fb2541e9d36 - <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop::h9871ec79020d3d08
  20:     0x7fb2541cdb4d - core::ptr::drop_in_place::h37be4f3688653901
  21:     0x7fb2541bfd31 - rustc_span::with_source_map::he9a81669cd160b82
  22:     0x7fb2541eebd8 - rustc_interface::interface::create_compiler_and_run::h06c2389085f2a79e
  23:     0x7fb2541c02aa - rustc_span::with_session_globals::h3a06e50e1db00721
  24:     0x7fb2541f148d - std::sys_common::backtrace::__rust_begin_short_backtrace::h6f73648415d0d9ce
  25:     0x7fb2541621ce - core::ops::function::FnOnce::call_once{{vtable.shim}}::h213be4bbd07cfb62
  26:     0x7fb25393796a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h1080dfe0ef616bdf
                               at /rustc/f68e08933d8f519a9655934fedebbc509661b219/library/alloc/src/boxed.rs:1042
  27:     0x7fb25393796a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::hd2747e1f2d5cec32
                               at /rustc/f68e08933d8f519a9655934fedebbc509661b219/library/alloc/src/boxed.rs:1042
  28:     0x7fb25393796a - std::sys::unix::thread::Thread::new::thread_start::hd0f336b4ef6808a7
                               at /rustc/f68e08933d8f519a9655934fedebbc509661b219/library/std/src/sys/unix/thread.rs:87
  29:     0x7fb2538343e9 - start_thread
  30:     0x7fb253751293 - __GI___clone
  31:                0x0 - <unknown>

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.48.0-nightly (f68e08933 2020-09-19) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `a`
```
pnkfelix

comment created time in a month

pull request commentrust-lang/rust

Validate constants during `const_eval_raw`

Looks like this introduced some perf regressions https://perf.rust-lang.org/compare.html?start=10b3595ba6a4c658c9dea105488fc562c815e434&end=5e449b9adff463455743291b0c1f76feec092992&stat=instructions:u

oli-obk

comment created time in a month

pull request commentrust-lang/rust-clippy

Forbid redundant_pattern_matching triggering in macros

Mmh, looks like a test is failing: https://github.com/rust-lang/rust-clippy/pull/6069/checks?check_run_id=1139967161#step:10:138

alex-700

comment created time in a month

PullRequestReviewEvent

Pull request review commentrust-lang/rust-clippy

Add new lint `unnecessary_wrap`

+use crate::utils::{+    is_type_diagnostic_item, match_qpath, multispan_sugg_with_applicability, paths, return_ty, snippet,+    span_lint_and_then,+};+use if_chain::if_chain;+use rustc_errors::Applicability;+use rustc_hir::intravisit::{FnKind, NestedVisitorMap, Visitor};+use rustc_hir::*;+use rustc_lint::{LateContext, LateLintPass};+use rustc_middle::{hir::map::Map, ty::subst::GenericArgKind};+use rustc_session::{declare_lint_pass, declare_tool_lint};+use rustc_span::Span;++declare_clippy_lint! {+    /// **What it does:** Checks for private functions that only return `Ok` or `Some`.+    ///+    /// **Why is this bad?** It is not meaningful to wrap values when no `None` or `Err` is returned.+    ///+    /// **Known problems:** Since this lint changes function type signature, you may need to+    /// adjust some codes at callee side.+    ///+    /// **Example:**+    ///+    /// ```rust+    /// pub fn get_cool_number(a: bool, b: bool) -> Option<i32> {+    ///     if a && b {+    ///         return Some(50);+    ///     }+    ///     if a {+    ///         Some(0)+    ///     } else {+    ///         Some(10)+    ///     }+    /// }+    /// ```+    /// Use instead:+    /// ```rust+    /// pub fn get_cool_number(a: bool, b: bool) -> i32 {+    ///     if a && b {+    ///         return 50;+    ///     }+    ///     if a {+    ///         0+    ///     } else {+    ///         10+    ///     }+    /// }+    /// ```

public functions should not be linted, so the example code should not be pub fns :)

matsujika

comment created time in a month

Pull request review commentrust-lang/rust-clippy

Add new lint `unnecessary_wrap`

+// run-rustfix++#![warn(clippy::unnecessary_wrap)]+#![allow(clippy::no_effect)]+#![allow(clippy::needless_return)]+#![allow(clippy::if_same_then_else)]+#![allow(dead_code)]++// should be linted+fn func1(a: bool, b: bool) -> Option<i32> {+    if a && b {+        return Some(42);+    }+    if a {+        Some(-1);+        Some(2)+    } else {+        return Some(1337);+    }+}++// public fns should not be linted+pub fn func2(a: bool) -> Option<i32> {+    if a {+        Some(1)+    } else {+        Some(1)+    }+}++// should not be linted+fn func3(a: bool) -> Option<i32> {+    if a {+        Some(1)+    } else {+        None+    }+}++// should be linted+fn func4() -> Option<i32> {+    Some(1)+}++// should be linted+fn func5() -> Result<i32, ()> {+    Ok(1)+}+

a test function that always Err or None might be useful as well.

matsujika

comment created time in a month

PullRequestReviewEvent
PullRequestReviewEvent

push eventmatthiaskrgr/rust

Marcel Hellwig

commit sha 00d537dcd03f9ff5ebdf8b86e039dbdb0a7f850c

deny(unsafe_op_in_unsafe_fn) in libstd/path.rs

view details

David Wood

commit sha 0f2bd56b29857453835e47abbe96a80b175632d1

lint/ty: move fns to avoid abstraction violation This commit moves `transparent_newtype_field` and `is_zst` to `LateContext` where they are used, rather than being on the `VariantDef` and `TyS` types. Signed-off-by: David Wood <david@davidtw.co>

view details

Scott McMurray

commit sha 6092828d1f432bb313818e7cfab961c0e494f69e

Add `[T; N]: TryFrom<Vec<T>>` This is very similar to the existing `Box<[T; N]>: TryFrom<Box<[T]>>`, but allows avoiding the `shrink_to_fit` if you have a vector and not a boxed slice.

view details

David Wood

commit sha f8376b59d1391a5191a561c44067355f1a99c7c0

shim: monomorphic `FnPtrShim`s during construction This commit adjusts MIR shim construction so that substitutions are applied to function pointer shims during construction, rather than during codegen (as determined by `substs_for_mir_body`) - as substitutions will no longer occur during codegen, function pointer shims can now be polymorphic without incurring double substitutions. Signed-off-by: David Wood <david@davidtw.co>

view details

kadmin

commit sha 6cb671628393e292d5e68e6367f80488ace46532

Add test for checking if-let or-patterns

view details

scottmcm

commit sha 2c8a4c8f73e8b36e72b15e7f97ef29ad36c15e17

Nightly is currently 1.48

view details

Ivan Tham

commit sha 685f04220ee584f00f60e5ff9d7aca16351c5399

Clean up vec benches bench_in_place style

view details

scottmcm

commit sha 3d89ee9586354e736cfe4a472d8aaa507d10f77c

Typo fix Thanks, Amanieu Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>

view details

Ralf Jung

commit sha caeb5544ecd9dba4d67b68b8c1b32d8132c6d5f2

do not inline black_box when building for Miri

view details

Ralf Jung

commit sha 4b5cd544d1268df8f95424a7dc77ce6c852bac56

use black_box instead of local optimziation barriers in const tests where possible

view details

Ralf Jung

commit sha 47668edb64ed1f8676cfcb4c9ccb6fe018f660c5

Separate feature flags Co-authored-by: Ivan Tham <pickfire@riseup.net>

view details

Ralf Jung

commit sha 284b16913aa6fccdf7b14edc3bb2693aadd39919

add missing feature flag

view details

Mara Bos

commit sha daa62d9081bfeeb0f438f88eb69082c227a5c221

Add as_str() and AsRef to string::Drain.

view details

Mara Bos

commit sha 673284058b53992cfd66c04b9db8e551a0dc9996

Show remaining data in string::Drain's Debug impl.

view details

Mara Bos

commit sha f5bb523e94b431c35b495b6ad6ae94495b653a5f

Add AsRef<[u8]> for String's Drain.

view details

Mara Bos

commit sha f2a32909e0649eb589406ddac63597ba34273c95

Mark AsRef impls for String's Drain as stable. Trait implementations effectively can't be #[unstable].

view details

Mara Bos

commit sha 829019d4043a6e9dd1305113f43b30fc8415893d

Disable AsRef implementations for String's Drain. Since trait implementations cannot be unstable, we should only add them when the as_str feature gets stabilized. Until then, only `.as_str()` is available (behind a feature gate).

view details

Ralf Jung

commit sha 91f7d761e762d0d9f47cf61cf5d942fd93eaf2a8

also assert ScalarMaybeUninit size

view details

Matthias Krüger

commit sha f567287f9f35e4d4781213bddc5770e270f48d0a

don't convert types to the same type with try_into (clippy::useless_conversion)

view details

Alistair Francis

commit sha de0d55cb3c197b13d90922c8998bf90399f3b8a2

library/panic_unwind: Add UNWIND_DATA_REG for RISC-V 32-bit Signed-off-by: Alistair Francis <alistair.francis@wdc.com>

view details

push time in a month

pull request commentrust-lang/rust

Warn-by-default lint for unused borrows

How similar is this to clippys needless_borrow lint? https://rust-lang.github.io/rust-clippy/master/#needless_borrow

ecstatic-morse

comment created time in a month

push eventmatthiaskrgr/rust

Matthias Krüger

commit sha 40dddd33059344b546a11f150c0ec63e797f021c

use matches!() macro for simple if let conditions

view details

push time in a month

more