jiebi/CodeConvo huggingface dataset:
use hint::spin_loop; <del> /// Save power or switch hyperthreads in a busy-wait spin-loop. </del> <ins> /// Signals the processor that it is entering a busy-wait spin-loop. </ins> /// <del> /// This function is deliberately more primitive than /// [`std::thread::yield_now`](../../../std/thread/fn.yield_now.html) and /// does not directly yield to the system's scheduler. /// In some cases it might be useful to use a combination of both functions. /// Careful benchmarking is advised. </del> <ins> /// Upon receiving spin-loop signal the processor can optimize its behavior by, for example, saving /// power or switching hyper-threads. </ins> /// <del> /// On some platforms this function may not do anything at all. </del> <ins> /// This function is different than [`std::thread::yield_now`] which directly yields to the /// system's scheduler, whereas `spin_loop_hint` only signals the processor that it is entering a /// busy-wait spin-loop without yielding control to the system's scheduler. /// /// Using a busy-wait spin-loop with `spin_loop_hint` is ideally used in situations where a /// contended lock is held by another thread executed on a different CPU and where the waiting /// times are relatively small. Because entering busy-wait spin-loop does not trigger the system's /// scheduler, no overhead for switching threads occurs. However, if the thread holding the /// contended lock is running on the same CPU, the spin-loop is likely to occupy an entire CPU slice /// before switching to the thread that holds the lock. If the contending lock is held by a thread /// on the same CPU or if the waiting times for acquiring the lock are longer, it is often better to /// use [`std::thread::yield_now`]. /// /// **Note**: On platforms that do not support receiving spin-loop hints this function does not /// do anything at all. /// /// [`std::thread::yield_now`]: ../../../std/thread/fn.yield_now.html </ins> #[inline] #[stable(feature = "spin_loop_hint", since = "1.24.0")] pub fn spin_loop_hint() {
self.unclosed_delims.extend(snapshot.unclosed_delims.clone()); } <ins> pub fn unclosed_delims(&self) -> &[UnmatchedBrace] { &self.unclosed_delims } </ins> /// Create a snapshot of the `Parser`. pub(super) fn create_snapshot_for_diagnostic(&self) -> SnapshotParser<'a> { let mut snapshot = self.clone();
use rustc_middle::hir::map::Map; use rustc_middle::hir::nested_filter; use rustc_middle::ty::TyCtxt; <ins> use rustc_parse::maybe_new_parser_from_source_str; use rustc_parse::parser::attr::InnerAttrPolicy; </ins> use rustc_session::config::{self, CrateType, ErrorOutputType}; <ins> use rustc_session::parse::ParseSess; </ins> use rustc_session::{lint, DiagnosticOutput, Session}; use rustc_span::edition::Edition; use rustc_span::source_map::SourceMap;
edition: Edition, test_id: Option<&str>, ) -> (String, usize, bool) { <del> let (crate_attrs, everything_else, crates) = partition_source(s); </del> <ins> let (crate_attrs, everything_else, crates) = partition_source(s, edition); </ins> let everything_else = everything_else.trim(); let mut line_offset = 0; let mut prog = String::new();
rustc_span::create_session_if_not_set_then(edition, |_| { use rustc_errors::emitter::{Emitter, EmitterWriter}; use rustc_errors::Handler; <del> use rustc_parse::maybe_new_parser_from_source_str; </del> use rustc_parse::parser::ForceCollect; <del> use rustc_session::parse::ParseSess; </del> use rustc_span::source_map::FilePathMapping; let filename = FileName::anon_source_code(s);
(prog, line_offset, supports_color) } <del> // FIXME(aburka): use a real parser to deal with multiline attributes fn partition_source(s: &str) -> (String, String, String) { </del> <ins> fn check_if_attr_is_complete(source: &str, edition: Edition) -> bool { if source.is_empty() { // Empty content so nothing to check in here... return true; } rustc_span::create_session_if_not_set_then(edition, |_| { let filename = FileName::anon_source_code(source); let sess = ParseSess::with_silent_emitter(None); let mut parser = match maybe_new_parser_from_source_str(&sess, filename, source.to_owned()) { Ok(p) => p, Err(_) => { debug!("Cannot build a parser to check mod attr so skipping..."); return true; } }; // If a parsing error happened, it's very likely that the attribute is incomplete. if !parser.parse_attribute(InnerAttrPolicy::Permitted).is_ok() { return false; } // We now check if there is an unclosed delimiter for the attribute. To do so, we look at // the `unclosed_delims` and see if the opening square bracket was closed. parser .unclosed_delims() .get(0) .map(|unclosed| { unclosed.unclosed_span.map(|s| s.lo()).unwrap_or(BytePos(0)) != BytePos(2) }) .unwrap_or(true) }) } fn partition_source(s: &str, edition: Edition) -> (String, String, String) { </ins> #[derive(Copy, Clone, PartialEq)] enum PartitionState { Attrs,
// shunted into "everything else" match state { PartitionState::Attrs => { <del> state = if trimline.starts_with("#![") || trimline.chars().all(|c| c.is_whitespace()) </del> <ins> state = if trimline.starts_with("#![") { if !check_if_attr_is_complete(line, edition) { mod_attr_pending = line.to_owned(); } else { mod_attr_pending.clear(); } PartitionState::Attrs } else if trimline.chars().all(|c| c.is_whitespace()) </ins> || (trimline.starts_with("//") && !trimline.starts_with("///")) { PartitionState::Attrs
{ PartitionState::Crates } else { <del> PartitionState::Other </del> <ins> // First we check if the previous attribute was "complete"... if !mod_attr_pending.is_empty() { // If not, then we append the new line into the pending attribute to check // if this time it's complete... mod_attr_pending.push_str(line); if !trimline.is_empty() && check_if_attr_is_complete(line, edition) { // If it's complete, then we can clear the pending content. mod_attr_pending.clear(); } // In any case, this is considered as `PartitionState::Attrs` so it's // prepended before rustdoc's inserts. PartitionState::Attrs } else { PartitionState::Other } </ins> }; } PartitionState::Crates => {
<ins> // compile-flags:--test // normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR" // normalize-stdout-test "finished in d+.d+s" -> "finished in $$TIME" // check-pass /// ``` /// # #![cfg_attr(not(dox), deny(missing_abi, /// # non_ascii_idents))] /// /// pub struct Bar; /// ``` pub struct Bar; </ins>
/// kept separate because of issue #42760. #[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)] pub enum DocFragment { <del> // FIXME #44229 (misdreavus): sugared and raw doc comments can be brought back together once // hoedown is completely removed from rustdoc. </del> /// A doc fragment created from a `///` or `//!` doc comment. SugaredDoc(usize, syntax_pos::Span, String), /// A doc fragment created from a "raw" `#[doc=""]` attribute.
start.to(end) } <ins> /// Reports a resolution failure diagnostic. /// /// Ideally we can report the diagnostic with the actual span in the source where the link failure /// occurred. However, there's a mismatch between the span in the source code and the span in the /// markdown, so we have to do a bit of work to figure out the correspondence. /// /// It's not too hard to find the span for sugared doc comments (`///` and `/**`), because the /// source will match the markdown exactly, excluding the comment markers. However, it's much more /// difficult to calculate the spans for unsugared docs, because we have to deal with escaping and /// other source features. So, we attempt to find the exact source span of the resolution failure /// in sugared docs, but use the span of the documentation attributes themselves for unsugared /// docs. Because this span might be overly large, we display the markdown line containing the /// failure as a note. </ins> fn resolution_failure( cx: &DocContext, attrs: &Attributes,
<ins> // ignore-tidy-cr // compile-pass // This file checks the spans of intra-link warnings in a file with CRLF line endings. The // .gitattributes file in this directory should enforce it. /// [error] pub struct A; /// /// docs [error1] /// docs [error2] /// pub struct B; /** * This is a multi-line comment. * * It also has an [error]. */ pub struct C; </ins>
<ins> warning: `[error]` cannot be resolved, ignoring it... --> $DIR/intra-links-warning-crlf.rs:8:6 | LL | /// [error] |      ^^^^^ cannot be resolved, ignoring | = note: #[warn(intra_doc_link_resolution_failure)] on by default = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` warning: `[error1]` cannot be resolved, ignoring it... --> $DIR/intra-links-warning-crlf.rs:12:11 | LL | /// docs [error1] |           ^^^^^^ cannot be resolved, ignoring | = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` warning: `[error2]` cannot be resolved, ignoring it... --> $DIR/intra-links-warning-crlf.rs:14:11 | LL | /// docs [error2] |           ^^^^^^ cannot be resolved, ignoring | = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` warning: `[error]` cannot be resolved, ignoring it... --> $DIR/intra-links-warning-crlf.rs:21:20 | LL |  * It also has an [error]. |                    ^^^^^ cannot be resolved, ignoring | = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` </ins>
} } f!("Foonbar [BarF] barnbaz"); <ins> /** # for example, * * time to introduce a link [error]*/ pub struct A; /** * # for example, * * time to introduce a link [error] */ pub struct B; #[doc = "single line [error]"] pub struct C; #[doc = "single line with "escaping" [error]"] pub struct D; /// Item docs. #[doc="Hello there!"] /// [error] pub struct E; /// /// docs [error1] /// docs [error2] /// pub struct F; </ins>
| = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` <ins> warning: `[error]` cannot be resolved, ignoring it... --> $DIR/intra-links-warning.rs:61:30 | LL |  * time to introduce a link [error]*/ |                              ^^^^^ cannot be resolved, ignoring | = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` warning: `[error]` cannot be resolved, ignoring it... --> $DIR/intra-links-warning.rs:67:30 | LL |  * time to introduce a link [error] |                              ^^^^^ cannot be resolved, ignoring | = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` warning: `[error]` cannot be resolved, ignoring it... --> $DIR/intra-links-warning.rs:71:1 | LL | #[doc = "single line [error]"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the link appears in this line: single line [error] ^^^^^ = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` warning: `[error]` cannot be resolved, ignoring it... --> $DIR/intra-links-warning.rs:74:1 | LL | #[doc = "single line with /"escaping/" [error]"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: the link appears in this line: single line with "escaping" [error] ^^^^^ = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` warning: `[error]` cannot be resolved, ignoring it... --> $DIR/intra-links-warning.rs:77:1 | LL | / /// Item docs. LL | | #[doc="Hello there!"] LL | | /// [error] | |___________^ | = note: the link appears in this line: [error] ^^^^^ = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` warning: `[error1]` cannot be resolved, ignoring it... --> $DIR/intra-links-warning.rs:83:11 | LL | /// docs [error1] |           ^^^^^^ cannot be resolved, ignoring | = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` warning: `[error2]` cannot be resolved, ignoring it... --> $DIR/intra-links-warning.rs:85:11 | LL | /// docs [error2] |           ^^^^^^ cannot be resolved, ignoring | = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` </ins> warning: `[BarA]` cannot be resolved, ignoring it... --> $DIR/intra-links-warning.rs:24:10 |
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` warning: `[BarB]` cannot be resolved, ignoring it... <del> --> $DIR/intra-links-warning.rs:28:1 </del> <ins> --> $DIR/intra-links-warning.rs:30:9 </ins> | <del> LL | / /** LL | |  * Foo LL | |  * bar [BarB] bar LL | |  * baz LL | |  */ | |___^ </del> <ins> LL |  * bar [BarB] bar |         ^^^^ cannot be resolved, ignoring </ins> | <del> = note: the link appears in this line: bar [BarB] bar ^^^^ </del> = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` warning: `[BarC]` cannot be resolved, ignoring it... <del> --> $DIR/intra-links-warning.rs:35:1 </del> <ins> --> $DIR/intra-links-warning.rs:37:6 </ins> | <del> LL | / /** Foo LL | | LL | | bar [BarC] bar LL | | baz ...  | LL | | LL | | */ | |__^ </del> <ins> LL | bar [BarC] bar |      ^^^^ cannot be resolved, ignoring </ins> | <del> = note: the link appears in this line: bar [BarC] bar ^^^^ </del> = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` warning: `[BarD]` cannot be resolved, ignoring it...
); // See https://github.com/rust-lang/rust/issues/32354 <del> if old_binding.is_import() || new_binding.is_import() { let binding = if new_binding.is_import() && !new_binding.span.is_dummy() { new_binding </del> <ins> let directive = match (&new_binding.kind, &old_binding.kind) { (NameBindingKind::Import { directive, .. }, _) if !new_binding.span.is_dummy() => Some((directive, new_binding.span)), (_, NameBindingKind::Import { directive, .. }) if !old_binding.span.is_dummy() => Some((directive, old_binding.span)), _ => None, }; if let Some((directive, binding_span)) = directive { let suggested_name = if name.as_str().chars().next().unwrap().is_uppercase() { format!("Other{}", name) </ins> } else { <del> old_binding </del> <ins> format!("other_{}", name) </ins> }; <del> let cm = self.session.source_map(); let rename_msg = "you can use `as` to change the binding name of the import"; if let ( Ok(snippet), NameBindingKind::Import { directive, ..}, _dummy @ false, ) = ( cm.span_to_snippet(binding.span), binding.kind.clone(), binding.span.is_dummy(), ) { let suggested_name = if name.as_str().chars().next().unwrap().is_uppercase() { format!("Other{}", name) } else { format!("other_{}", name) }; </del> <ins> let mut suggestion = None; match directive.subclass { ImportDirectiveSubclass::SingleImport { type_ns_only: true, .. } => suggestion = Some(format!("self as {}", suggested_name)), ImportDirectiveSubclass::SingleImport { source, .. } => { if let Some(pos) = source.span.hi().0.checked_sub(binding_span.lo().0) .map(|pos| pos as usize) { if let Ok(snippet) = self.session.source_map() .span_to_snippet(binding_span) { if pos <= snippet.len() { suggestion = Some(format!( "{} as {}{}", &snippet[..pos], suggested_name, if snippet.ends_with(";") { ";" } else { "" } )) } } } } ImportDirectiveSubclass::ExternCrate { source, target, .. } => suggestion = Some(format!( "extern crate {} as {};", source.unwrap_or(target.name), suggested_name, )), _ => unreachable!(), } let rename_msg = "you can use `as` to change the binding name of the import"; if let Some(suggestion) = suggestion { </ins> err.span_suggestion_with_applicability( <del> binding.span, &rename_msg, match directive.subclass { ImportDirectiveSubclass::SingleImport { type_ns_only: true, .. } => format!("self as {}", suggested_name), ImportDirectiveSubclass::SingleImport { source, .. } => format!( "{} as {}{}", &snippet[..((source.span.hi().0 - binding.span.lo().0) as usize)], suggested_name, if snippet.ends_with(";") { ";" } else { "" } ), ImportDirectiveSubclass::ExternCrate { source, target, .. } => format!( "extern crate {} as {};", source.unwrap_or(target.name), suggested_name, ), _ => unreachable!(), }, </del> <ins> binding_span, rename_msg, suggestion, </ins> Applicability::MaybeIncorrect, ); } else { <del> err.span_label(binding.span, rename_msg); </del> <ins> err.span_label(binding_span, rename_msg); </ins> } }
<ins> macro_rules! import { ( $($name:ident),* ) => { $( mod $name; pub use self::$name; //~^ ERROR the name `issue_56411_aux` is defined multiple times //~| ERROR `issue_56411_aux` is private, and cannot be re-exported )* } } import!(issue_56411_aux); fn main() { println!("Hello, world!"); } </ins>
<ins> error[E0255]: the name `issue_56411_aux` is defined multiple times --> $DIR/issue-56411.rs:5:21 | LL |             mod $name; |             ---------- previous definition of the module `issue_56411_aux` here LL |             pub use self::$name; |                     ^^^^^^^^^^^ |                     | |                     `issue_56411_aux` reimported here |                     you can use `as` to change the binding name of the import ... LL | import!(issue_56411_aux); | ------------------------- in this macro invocation | = note: `issue_56411_aux` must be defined only once in the type namespace of this module error[E0365]: `issue_56411_aux` is private, and cannot be re-exported --> $DIR/issue-56411.rs:5:21 | LL |             pub use self::$name; |                     ^^^^^^^^^^^ re-export of private `issue_56411_aux` ... LL | import!(issue_56411_aux); | ------------------------- in this macro invocation | = note: consider declaring type or module `issue_56411_aux` with `pub` error: aborting due to 2 previous errors Some errors occurred: E0255, E0365. For more information about an error, try `rustc --explain E0255`. </ins>
// Linux. This was added in 2.6.28, however, and because we support // 2.6.18 we must detect this support dynamically. if cfg!(target_os = "linux") { <del> weak! { fn accept4(c_int, *mut sockaddr, *mut socklen_t, c_int) -> c_int </del> <ins> syscall! { fn accept4( fd: c_int, addr: *mut sockaddr, addr_len: *mut socklen_t, flags: c_int ) -> c_int </ins> } <del> if let Some(accept) = accept4.get() { let res = cvt_r(|| unsafe { accept(self.0.raw(), storage, len, SOCK_CLOEXEC) }); match res { Ok(fd) => return Ok(Socket(FileDesc::new(fd))), Err(ref e) if e.raw_os_error() == Some(libc::ENOSYS) => {} Err(e) => return Err(e), } </del> <ins> let res = cvt_r(|| unsafe { accept4(self.0.raw(), storage, len, SOCK_CLOEXEC) }); match res { Ok(fd) => return Ok(Socket(FileDesc::new(fd))), Err(ref e) if e.raw_os_error() == Some(libc::ENOSYS) => {} Err(e) => return Err(e), </ins> } }
} /// Sets the platform-specific value of errno <del> #[cfg(any(target_os = "solaris", target_os = "fuchsia"))] // only needed for readdir so far </del> <ins> #[cfg(all(not(target_os = "linux"), not(target_os = "dragonfly")))] // needed for readdir and syscall! </ins> pub fn set_errno(e: i32) { unsafe { *errno_location() = e as c_int
pub struct AnonPipe(FileDesc); pub fn anon_pipe() -> io::Result<(AnonPipe, AnonPipe)> { <del> weak! { fn pipe2(*mut c_int, c_int) -> c_int } </del> <ins> syscall! { fn pipe2(fds: *mut c_int, flags: c_int) -> c_int } </ins> static INVALID: AtomicBool = ATOMIC_BOOL_INIT; let mut fds = [0; 2];
!INVALID.load(Ordering::SeqCst) { <del> if let Some(pipe) = pipe2.get() { // Note that despite calling a glibc function here we may still // get ENOSYS. Glibc has `pipe2` since 2.9 and doesn't try to // emulate on older kernels, so if you happen to be running on // an older kernel you may see `pipe2` as a symbol but still not // see the syscall. match cvt(unsafe { pipe(fds.as_mut_ptr(), libc::O_CLOEXEC) }) { Ok(_) => { return Ok((AnonPipe(FileDesc::new(fds[0])), AnonPipe(FileDesc::new(fds[1])))); } Err(ref e) if e.raw_os_error() == Some(libc::ENOSYS) => { INVALID.store(true, Ordering::SeqCst); } Err(e) => return Err(e), </del> <ins> // Note that despite calling a glibc function here we may still // get ENOSYS. Glibc has `pipe2` since 2.9 and doesn't try to // emulate on older kernels, so if you happen to be running on // an older kernel you may see `pipe2` as a symbol but still not // see the syscall. match cvt(unsafe { pipe2(fds.as_mut_ptr(), libc::O_CLOEXEC) }) { Ok(_) => { return Ok((AnonPipe(FileDesc::new(fds[0])), AnonPipe(FileDesc::new(fds[1])))); } Err(ref e) if e.raw_os_error() == Some(libc::ENOSYS) => { INVALID.store(true, Ordering::SeqCst); </ins> } <ins> Err(e) => return Err(e), </ins> } } cvt(unsafe { libc::pipe(fds.as_mut_ptr()) })?;
}; libc::dlsym(libc::RTLD_DEFAULT, name.as_ptr()) as usize } <ins> #[cfg(not(target_os = "linux"))] macro_rules! syscall { (fn $name:ident($($arg_name:ident: $t:ty),*) -> $ret:ty) => ( unsafe fn $name($($arg_name: $t),*) -> $ret { use libc; use super::os; weak! { fn $name($($t),*) -> $ret } if let Some(fun) = $name.get() { fun($($arg_name),*) } else { os::set_errno(libc::ENOSYS); -1 } } ) } #[cfg(target_os = "linux")] macro_rules! syscall { (fn $name:ident($($arg_name:ident: $t:ty),*) -> $ret:ty) => ( unsafe fn $name($($arg_name:$t),*) -> $ret { // This looks like a hack, but concat_idents only accepts idents // (not paths). use libc::*; syscall( concat_idents!(SYS_, $name), $($arg_name as c_long),* ) as $ret } ) } </ins>
// Only allow statics (not consts) to refer to other statics. if self.mode == Mode::Static || self.mode == Mode::StaticMut { <del> if context.is_mutating_use() { </del> <ins> if self.mode == Mode::Static && context.is_mutating_use() { </ins> // this is not strictly necessary as miri will also bail out // For interior mutability we can't really catch this statically as that // goes through raw pointers and intermediate temporaries, so miri has
<ins> error[E0017]: references in statics may only refer to immutable values --> $DIR/static_mut_containing_mut_ref2.rs:5:46 | LL | pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; }; |                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^ statics require immutable values error[E0019]: static contains unimplemented expression type --> $DIR/static_mut_containing_mut_ref2.rs:5:45 | LL | pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; }; |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors Some errors occurred: E0017, E0019. For more information about an error, try `rustc --explain E0017`. </ins>
<ins> error[E0080]: could not evaluate static initializer --> $DIR/static_mut_containing_mut_ref3.rs:5:31 | LL | static mut BAR: () = unsafe { FOO.0 = 99; }; |                               ^^^^^^^^^^ tried to modify a static's initial value from another static's initializer error: aborting due to previous error For more information about this error, try `rustc --explain E0080`. </ins>
pub static mut A: u32 = 0; pub static mut B: () = unsafe { A = 1; }; <del> //~^ ERROR cannot mutate statics in the initializer of another static </del> <ins> //~^ ERROR could not evaluate static initializer </ins> pub static mut C: u32 = unsafe { C = 1; 0 }; <del> //~^ ERROR cannot mutate statics in the initializer of another static </del> <ins> //~^ ERROR cycle detected </ins> pub static D: u32 = D;
<del> error: cannot mutate statics in the initializer of another static </del> <ins> error[E0080]: could not evaluate static initializer </ins> --> $DIR/write-to-static-mut-in-static.rs:14:33 | LL | pub static mut B: () = unsafe { A = 1; }; <del> |                                 ^^^^^ </del> <ins> |                                 ^^^^^ tried to modify a static's initial value from another static's initializer </ins> <del> error: cannot mutate statics in the initializer of another static </del> <ins> error[E0391]: cycle detected when const-evaluating `C` </ins> --> $DIR/write-to-static-mut-in-static.rs:17:34 | LL | pub static mut C: u32 = unsafe { C = 1; 0 }; |                                  ^^^^^ <ins> | note: ...which requires const-evaluating `C`... --> $DIR/write-to-static-mut-in-static.rs:17:1 | LL | pub static mut C: u32 = unsafe { C = 1; 0 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: ...which again requires const-evaluating `C`, completing the cycle note: cycle used when const-evaluating + checking `C` --> $DIR/write-to-static-mut-in-static.rs:17:1 | LL | pub static mut C: u32 = unsafe { C = 1; 0 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ </ins> error: aborting due to 2 previous errors <ins> Some errors occurred: E0080, E0391. For more information about an error, try `rustc --explain E0080`. </ins>