You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Specifying static-nobundle on command line causes an internal compiler error #57323
E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
rustc -l static-nobundle=nonexistent main.rs
---
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src\libcore\option.rs:345:21
note:Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: internal compiler error:unexpected panic
I'm very new to Rust so forgive my naivety. Since span may not exist, I assume we need to change span.unwrap() to span.unwrap_or_else() and provide a default value? From the documentation, I couldn't think of a suitable default value for Span which is expected by feature_gate::emit_feature_err(). I couldn't think of any other changes as per your statement:
assumes that the span always exists, which is not true for things passed from command line.
Does this mean that we should throw an error when span is empty? From the original description, it seemed to me that having a Span value was optional. If throwing an error is the way to go, then I think your solution is the appropriate solution.
@AB1908
If type has a default value, it's usually defined somewhere around the definition of that type.
In case of Spanpub const DUMMY_SP: Span = Span(0); is also defined in right below the span definition pub struct Span(u32); in libsyntax_pos/span_encoding.rs
E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Activity
AB1908 commentedon Jan 4, 2019
I'm very new to Rust so forgive my naivety. Since
spanmay not exist, I assume we need to changespan.unwrap()tospan.unwrap_or_else()and provide a default value? From the documentation, I couldn't think of a suitable default value forSpanwhich is expected byfeature_gate::emit_feature_err(). I couldn't think of any other changes as per your statement:Patryk27 commentedon Jan 4, 2019
Maybe instead of
unwrap_or_else()we could go this way?(see: processing error messages in the
process_command_linefunction below thatregister_native_lib)AB1908 commentedon Jan 4, 2019
Does this mean that we should throw an error when
spanis empty? From the original description, it seemed to me that having aSpanvalue was optional. If throwing an error is the way to go, then I think your solution is the appropriate solution.petrochenkov commentedon Jan 4, 2019
@AB1908
DUMMY_SPis the value that's usually used if the span is unknown or doesn't exist.AB1908 commentedon Jan 4, 2019
Alright. For future reference, how was I to find that out?
petrochenkov commentedon Jan 4, 2019
@AB1908
If type has a default value, it's usually defined somewhere around the definition of that type.
In case of
Spanpub const DUMMY_SP: Span = Span(0);is also defined in right below the span definitionpub struct Span(u32);inlibsyntax_pos/span_encoding.rsAB1908 commentedon Jan 4, 2019
Thanks for the hand-holding. I'll try to make the necessary changes and start a PR.
Rollup merge of rust-lang#57650 - AB1908:master, r=petrochenkov
Rollup merge of rust-lang#57650 - AB1908:master, r=petrochenkov
Rollup merge of rust-lang#57650 - AB1908:master, r=petrochenkov
Rollup merge of rust-lang#57650 - AB1908:master, r=petrochenkov
Pass a default value when unwrapping a span