jiebi/CodeConvo huggingface dataset:
Change:
Some operations, such as raw pointer comparisons, require when inside a const context. To my knowledge, none of these operations have been const-stabilized. Accordingly, the fails to compile due to a missing unsafe block. However, the check does not run for functions. The following : This is an easy problem to fix, but the root cause here is poor naming. Specifically, should be renamed and should be . We have had other issues due to this in the past. cc to weigh in on the renaming.
Yeah I recall being confused by those names in the past, too. Definite :+1: for changing them. As for concrete proposals, I don't actually remember what these queries are doing, but your suggestions sound reasonable. :)
Oh, the names are different than in the email I got because you edited.^^ So does take the context (feature flags etc) into account? The name sounds like it would. What about , to make it a bit shorter?
Damn. I was hoping no one would catch me :smile:. would indeed take feature flags into account to mirror the current behavior of . I originally had , but that's not really correct, since it would also return if the function was unstable but the requisite feature flags were set.

Discussion:
use std::ops::Bound; <del> use crate::const_eval::{is_const_fn, is_min_const_fn}; </del> <ins> use crate::const_eval::is_min_const_fn; </ins> use crate::util; pub struct UnsafetyChecker<'a, 'tcx> {

let (const_context, min_const_fn) = match tcx.hir().body_owner_kind(id) { hir::BodyOwnerKind::Closure => (false, false), hir::BodyOwnerKind::Fn => { <del> (is_const_fn(tcx, def_id.to_def_id()), is_min_const_fn(tcx, def_id.to_def_id())) </del> <ins> (tcx.is_const_fn_raw(def_id.to_def_id()), is_min_const_fn(tcx, def_id.to_def_id())) </ins> } hir::BodyOwnerKind::Const | hir::BodyOwnerKind::Static(_) => (true, false), };

<ins> #![stable(feature = "foo", since = "1.33.0")] #![feature(staged_api)] #![feature(const_compare_raw_pointers)] #![feature(const_fn)] #[stable(feature = "foo", since = "1.33.0")] #[rustc_const_unstable(feature = "const_foo", issue = "none")] const fn unstable(a: *const i32, b: *const i32) -> bool { a == b //~^ pointer operation is unsafe } fn main() {} </ins>

<ins> error[E0133]: pointer operation is unsafe and requires unsafe function or block --> $DIR/unsafe-unstable-const-fn.rs:9:5 | LL |     a == b |     ^^^^^^ pointer operation | = note: operations on pointers in constants error: aborting due to previous error For more information about this error, try `rustc --explain E0133`. </ins>
Change:
<!-- 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. --<!-- 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. --: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details<!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --This issue has been assigned to via . <!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
modify labels to +A-inline-assembly +F-asm +requires-nightly +O-riscv
Interestingly this does not reproduce when change register names to x86 ones; a error will be generated correctly.
I think I've located the issue. claim
claim

Discussion:
name: Symbol, ) -> Result<Self, &'static str> { // FIXME: use direct symbol comparison for register names <del> name.with(|name| { Ok(match arch { InlineAsmArch::X86 | InlineAsmArch::X86_64 => { Self::X86(X86InlineAsmReg::parse(arch, has_feature, name)?) } InlineAsmArch::Arm => Self::Arm(ArmInlineAsmReg::parse(arch, has_feature, name)?), InlineAsmArch::AArch64 => { Self::AArch64(AArch64InlineAsmReg::parse(arch, has_feature, name)?) } InlineAsmArch::RiscV32 | InlineAsmArch::RiscV64 => { Self::RiscV(RiscVInlineAsmReg::parse(arch, has_feature, name)?) } }) </del> <ins> // Use `Symbol::as_str` instead of `Symbol::with` here because `has_feature` may access `Symbol`. let name = name.as_str(); Ok(match arch { InlineAsmArch::X86 | InlineAsmArch::X86_64 => { Self::X86(X86InlineAsmReg::parse(arch, has_feature, &name)?) } InlineAsmArch::Arm => Self::Arm(ArmInlineAsmReg::parse(arch, has_feature, &name)?), InlineAsmArch::AArch64 => { Self::AArch64(AArch64InlineAsmReg::parse(arch, has_feature, &name)?) } InlineAsmArch::RiscV32 | InlineAsmArch::RiscV64 => { Self::RiscV(RiscVInlineAsmReg::parse(arch, has_feature, &name)?) } </ins> }) }
Change:
erroneous recursive types (without being wrapped with ) having methods whose return type is causes the assertion failure.I expected the error message "recursive type has infinite size." Indeed, if there is no method with return type , we got the following normal error messages:aborted with the following assertion failure.:
glacier
Error: Parsing glacier command in failed: ...'cier https' ''... Please let know if you're having trouble with this bot.
glacier
Error: Parsing glacier command in failed: ...'cier https' ''... Please let know if you're having trouble with this bot.
glacier ""
Error: The feature is not enabled in this repository. To enable it add its section in the in the root of the repository. Please let know if you're having trouble with this bot.
Oh, we must have enabled this... Sorry for the noise!
I think now we could... glacier ""
Making the following change: makes the output look correct, but I am not sure of whether that should be the fix, making it always a and continue returning the or make the caller return instead (which seems to me to be the correct behavior). I do not understand why this has to panic in the first place.
Triage: Seems the ICE is fixed with the latest nightly, now catches this correctly (not bisected yet). Marking as E-needs-test, cc for awareness.

Discussion:
<ins> use std::collections::BTreeSet; #[derive(Hash)] pub enum ElemDerived { //~ ERROR recursive type `ElemDerived` has infinite size A(ElemDerived) } pub enum Elem { Derived(ElemDerived) } pub struct Set(BTreeSet<Elem>); impl Set { pub fn into_iter(self) -> impl Iterator<Item = Elem> { self.0.into_iter() } } fn main() {} </ins>

<ins> error[E0072]: recursive type `ElemDerived` has infinite size --> $DIR/issue-72554.rs:4:1 | LL | pub enum ElemDerived { | ^^^^^^^^^^^^^^^^^^^^ recursive type has infinite size LL |     A(ElemDerived) |       ----------- recursive without indirection | = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `ElemDerived` representable error: aborting due to previous error For more information about this error, try `rustc --explain E0072`. </ins>
Change:
When using the feature, attempting to match on a tuple creates a compiler panic. The following code causes the panic. (Also available at the ) This occurs both on the playground and on my local machine on a previous version (details below). Rust version from the playground: Local version: Playground backtrace: Local backtrace: EDIT: Added local machine backtrace too
It looks like the problem is here in . The call to seems to rely on the invariant that the match pairs have been fully simplified at this point, but are a special case and can still show up here.
Reproducible with recent nightlies too: : Triggered by more than 3 pattern condition with this compiler version.
I would have assumed that the implementation merely desugars into a bunch of top-level or-patterns. Is that not the case? Why are tuples special cased? If it isn't too involved, I could take a crack at this with some guidance... very much want to see this over the finish line.

Discussion:
(&TestKind::Range { .. }, _) => None, (&TestKind::Eq { .. } | &TestKind::Len { .. }, _) => { <ins> // The call to `self.test(&match_pair)` below is not actually used to generate any // MIR. Instead, we just want to compare with `test` (the parameter of the method) // to see if it is the same. // // However, at this point we can still encounter or-patterns that were extracted // from previous calls to `sort_candidate`, so we need to manually address that // case to avoid panicking in `self.test()`. if let PatKind::Or { .. } = &*match_pair.pattern.kind { return None; } </ins> // These are all binary tests. // // FIXME(#29623) we can be more clever here

<ins> // run-pass #![feature(or_patterns)] fn main() { assert!(f("", 0)); assert!(f("a", 1)); assert!(f("b", 1)); assert!(!f("", 1)); assert!(!f("a", 0)); assert!(!f("b", 0)); assert!(!f("asdf", 32)); //// assert!(!g(true, true, true)); assert!(!g(false, true, true)); assert!(!g(true, false, true)); assert!(!g(false, false, true)); assert!(!g(true, true, false)); assert!(g(false, true, false)); assert!(g(true, false, false)); assert!(g(false, false, false)); //// assert!(!h(true, true, true)); assert!(!h(false, true, true)); assert!(!h(true, false, true)); assert!(!h(false, false, true)); assert!(!h(true, true, false)); assert!(h(false, true, false)); assert!(h(true, false, false)); assert!(h(false, false, false)); } fn f(s: &str, num: usize) -> bool { match (s, num) { ("", 0) | ("a" | "b", 1) => true, _ => false, } } fn g(x: bool, y: bool, z: bool) -> bool { match (x, y, x, z) { (true | false, false, true, false) => true, (false, true | false, true | false, false) => true, (true | false, true | false, true | false, true) => false, (true, true | false, true | false, false) => false, } } fn h(x: bool, y: bool, z: bool) -> bool { match (x, (y, (x, (z,)))) { (true | false, (false, (true, (false,)))) => true, (false, (true | false, (true | false, (false,)))) => true, (true | false, (true | false, (true | false, (true,)))) => false, (true, (true | false, (true | false, (false,)))) => false, } } </ins>
Change:
lint introduced in causes false positives for . To reproduce: I expected to execute correctly. Instead, this happened: I expect to be ignored by this lint, because they are in fact used in modules. "remove the dependency or add " help message is also unhelpful, because it will cause unresolved imports for and similar commands. : <details<summaryFull verbose build log</summary<p</p</details
cc needs to be removed from the lint group, I didn't notice this when reviewing Otherwise it can be enabled in a blanket way without enabling specifically, which is undesirable given the amount of redundant options passed by Cargo.
Fixed in
Yeah this is the reason it's not on by default. We still need to work out if/how it can be used with cargo in a reasonable way. Adding it to made sense to me but I didn't think through the fallout.
Though TBH I'm a bit confused - what targets is Cargo passing dev-dependencies to aside from tests? I would have thought your case would be OK. Hm, I think there may be another bug that isn't seeing uses in blocks. At the very least it needs a test for that.
As far as I can tell, this issue wasn't fixed, was just removed from the group. The functionality of is still desirable! See

Discussion:
UNUSED_ALLOCATION, UNUSED_DOC_COMMENTS, UNUSED_EXTERN_CRATES, <del> UNUSED_CRATE_DEPENDENCIES, </del> UNUSED_FEATURES, UNUSED_LABELS, UNUSED_PARENS,

<ins> // `unused_crate_dependencies` is not currently in the `unused` group // due to false positives from Cargo. // check-pass // aux-crate:bar=bar.rs #![deny(unused)] fn main() {} </ins>
Change:
<!-- 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. --: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p may be related, but I don't think this is the same bug because the above ICEs with nightly-2020-05-29.
cc

Discussion:
let self_ty = self.resolve_vars_if_possible(&trait_ref.self_ty()); <ins> // Do not check on infer_types to avoid panic in evaluate_obligation. if self_ty.has_infer_types() { return; } let self_ty = self.tcx.erase_regions(&self_ty); </ins> let impls_future = self.tcx.type_implements_trait(( future_trait, self_ty,

trait_def_id, ty, params, param_env ); <del> // Do not check on infer_types to avoid panic in evaluate_obligation. if ty.has_infer_types() { return false; } let ty = tcx.erase_regions(&ty); </del> let trait_ref = ty::TraitRef { def_id: trait_def_id, substs: tcx.mk_substs_trait(ty, params) }; let obligation = Obligation {

<ins> // edition:2018 // compile-flags: -Cincremental=tmp/issue-72766 pub struct SadGirl; impl SadGirl { pub async fn call(&self) -> Result<(), ()> { Ok(()) } } async fn async_main() -> Result<(), ()> { // should be `.call().await?` SadGirl {}.call()?; //~ ERROR: the `?` operator can only be applied to values Ok(()) } fn main() { let _ = async_main(); } </ins>

<ins> error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try` --> $DIR/issue-72766.rs:14:5 | LL |     SadGirl {}.call()?; |     ^^^^^^^^^^^^^^^^^^ |     | |     the `?` operator cannot be applied to type `impl std::future::Future` |     help: consider using `.await` here: `SadGirl {}.call().await?` | = help: the trait `std::ops::Try` is not implemented for `impl std::future::Future` = note: required by `std::ops::Try::into_result` error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. </ins>

trait_id: DefId, ty_params: &[GenericArg<'tcx>], ) -> bool { <ins> // Do not check on infer_types to avoid panic in evaluate_obligation. if ty.has_infer_types() { return false; } let ty = cx.tcx.erase_regions(&ty); </ins> let ty_params = cx.tcx.mk_substs(ty_params.iter()); cx.tcx.type_implements_trait((trait_id, ty, ty_params, cx.param_env)) }
Change:
Running a make check pollutes the build directory with a file named ''. It looks like this is coming from rustpkg.

Discussion:
match fcx.llself { Some(slf) => { <del> // We really should do this regardless of whether self is owned, but // it doesn't work right with default method impls yet. (FIXME: #2794) if slf.is_owned { let self_val = if datum::appropriate_mode(slf.t).is_by_value() { let tmp = BitCast(bcx, slf.v, type_of(bcx.ccx(), slf.t)); let alloc = alloc_ty(bcx, slf.t); Store(bcx, tmp, alloc); alloc } else { PointerCast(bcx, slf.v, type_of(bcx.ccx(), slf.t).ptr_to()) }; fcx.llself = Some(ValSelfData {v: self_val, ..slf}); add_clean(bcx, self_val, slf.t); } </del> <ins> let self_val = if slf.is_owned && datum::appropriate_mode(slf.t).is_by_value() { let tmp = BitCast(bcx, slf.v, type_of(bcx.ccx(), slf.t)); let alloc = alloc_ty(bcx, slf.t); Store(bcx, tmp, alloc); alloc } else { PointerCast(bcx, slf.v, type_of(bcx.ccx(), slf.t).ptr_to()) }; fcx.llself = Some(ValSelfData {v: self_val, ..slf}); if slf.is_owned { add_clean(bcx, self_val, slf.t); } </ins> } _ => {} }

debug!("def_self() reference, self_info.t=%s", self_info.t.repr(bcx.tcx())); <del> // This cast should not be necessary. We should cast self *once*, // but right now this conflicts with default methods. let real_self_ty = monomorphize_type(bcx, self_info.t); let llselfty = type_of::type_of(bcx.ccx(), real_self_ty).ptr_to(); let casted_val = PointerCast(bcx, self_info.v, llselfty); </del> Datum { <del> val: casted_val, </del> <ins> val: self_info.v, </ins> ty: self_info.t, mode: ByRef(ZeroMem) }

let self_ty = ty::node_id_to_type(ccx.tcx, method.self_id); let self_ty = match param_substs { None => self_ty, <del> Some(@param_substs {tys: ref tys, _}) => { ty::subst_tps(ccx.tcx, *tys, None, self_ty) </del> <ins> Some(@param_substs {tys: ref tys, self_ty: ref self_sub, _}) => { ty::subst_tps(ccx.tcx, *tys, *self_sub, self_ty) </ins> } }; debug!("calling trans_fn with self_ty %s",
Change:
<!-- 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. --Here's MCVE: (Edited by JohnTitor) Prettied a bit: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details
Just for reference - works fine with explicit lifetimes:
modify labels: +requires-nightly +F-typealiasimpl_trait
Smaller:
Seems this is fixed in the latest nightly (not bisected yet). Marking as and will try to bisect later.
Still crashes with Ohh, good catch! Still, the regression test here is useful but let's keep this open then :) Oops, closed by mistake XD
Bisected, it's fixed by .
This ICEs again now:
Because of , dropped .
This no longer crashes with rustc-git ! modify labels: E-needs-test
Hm, I was too quick. It no longer crashes because it misses a feature gate. ` If I add the gate, it crashes again :/ modify labels: E-needs-test
cc which probably fixes this
Seems to be fixed again

Discussion:
<ins> // check-pass // compile-flags: -Zmir-opt-level=3 #![feature(type_alias_impl_trait)] trait T { type Item; } type Alias<'a> = impl T<Item = &'a ()>; struct S; impl<'a> T for &'a S { type Item = &'a (); } fn filter_positive<'a>() -> Alias<'a> { &S } fn with_positive(fun: impl Fn(Alias<'_>)) { fun(filter_positive()); } fn main() { with_positive(|_| ()); } </ins>
Change:
Amusingly the following ICEs while has a compiler error that hints at the const generic actually getting resolved. () Errors:
Also happens on stable without the feature gate
Triage: This is no longer ICE and emits an error correctly by . Marking as E-needs-test.

Discussion:
<ins> // Regression test for #72819: ICE due to failure in resolving the const generic in `Arr`'s type // bounds. #![feature(const_generics)] #![allow(incomplete_features)] struct Arr<const N: usize> where Assert::<{N < usize::max_value() / 2}>: IsTrue, //~^ ERROR constant expression depends on a generic parameter { } enum Assert<const CHECK: bool> {} trait IsTrue {} impl IsTrue for Assert<true> {} fn main() { let x: Arr<{usize::max_value()}> = Arr {}; } </ins>

<ins> error: constant expression depends on a generic parameter --> $DIR/issue-72819-generic-in-const-eval.rs:7:47 | LL | where Assert::<{N < usize::max_value() / 2}>: IsTrue, |                                               ^^^^^^ | = note: this may fail depending on what value the parameter takes error: aborting due to previous error </ins>
Change:
One of the tests in my enumset crate has started throwing an ICE on the latest nightly. The problem seems to be that I use an associated type as a field in a struct I'm structurally matching, and this has been broken on the latest nightly. <details<summary<strongBacktrace</strong</summary<p</p</details<!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
cc
cc looks like it's likely EDIT: oh 's type is fully concrete, so the field type () could be normalized and then it would be structurally matcheable. This is a reason why using a trait might be better, it wouldn't have edge cases like this (although it has other complications). At the very least we should normalize.
I also believe we are forgetting to normalize here, will look into it. claim
points a regression in which may confirm that is the culprit.
Assigning .

Discussion:
// fields of ADT. let tcx = self.tcx(); for field_ty in adt_def.all_fields().map(|field| field.ty(tcx, substs)) { <del> if field_ty.visit_with(self) { </del> <ins> let ty = self.tcx().normalize_erasing_regions(ty::ParamEnv::empty(), field_ty); debug!("structural-match ADT: field_ty={:?}, ty={:?}", field_ty, ty); if ty.visit_with(self) { </ins> // found an ADT without structural-match; halt visiting! assert!(self.found.is_some()); return true;

<ins> // run-pass trait EnumSetType { type Repr; } enum Enum8 { } impl EnumSetType for Enum8 { type Repr = u8; } #[derive(PartialEq, Eq)] struct EnumSet<T: EnumSetType> { __enumset_underlying: T::Repr, } const CONST_SET: EnumSet<Enum8> = EnumSet { __enumset_underlying: 3 }; fn main() { match CONST_SET { CONST_SET => { /* ok */ } _ => panic!("match fell through?"), } } </ins>
Change:
<!-- 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. --code from ./src/test/ui/asm/issue- <!-- 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. --repo is @ <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details
Does this still happen with (now merged)
I can confirm its fixed. We can probably close this issue.
Closing this, thanks for taking a look!

Discussion:
<ins> // compile-flags: -Zsave-analysis </ins> // only-x86_64 <ins> // Also test for #72960 </ins> #![feature(asm)]

error: invalid register `invalid`: unknown register <del> --> $DIR/issue-72570.rs:7:18 </del> <ins> --> $DIR/issue-72570.rs:9:18 </ins> | LL |         asm!("", in("invalid") "".len()); |                  ^^^^^^^^^^^^^^^^^^^^^^
Change:
<!-- 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. --code from <!-- 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. --repo is @ <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details
another one: another one:
I am on it
Same issue happened after upgraded to the latest version today.
Yes the has not landed yet.

Discussion:
// As write_sub_paths, but does not process the last ident in the path (assuming it // will be processed elsewhere). See note on write_sub_paths about global. fn write_sub_paths_truncated(&mut self, path: &'tcx hir::Path<'tcx>) { <del> for seg in &path.segments[..path.segments.len() - 1] { if let Some(data) = self.save_ctxt.get_path_segment_data(seg) { self.dumper.dump_ref(data); </del> <ins> if let [segments @ .., _] = path.segments { for seg in segments { if let Some(data) = self.save_ctxt.get_path_segment_data(seg) { self.dumper.dump_ref(data); } </ins> } } }

} } } <del> hir::ExprKind::Struct(hir::QPath::Resolved(_, path), ..) => { </del> <ins> hir::ExprKind::Struct(qpath, ..) => { let segment = match qpath { hir::QPath::Resolved(_, path) => path.segments.last().unwrap(), hir::QPath::TypeRelative(_, segment) => segment, }; </ins> match self.tables.expr_ty_adjusted(&hir_node).kind { ty::Adt(def, _) if !def.is_enum() => { <del> let sub_span = path.segments.last().unwrap().ident.span; </del> <ins> let sub_span = segment.ident.span; </ins> filter!(self.span_utils, sub_span); let span = self.span_from_span(sub_span); Some(Data::RefData(Ref {

} _ => { // FIXME <del> bug!(); </del> <ins> bug!("invalid expression: {:?}", expr); </ins> } } }

<ins> // compile-flags: -Zsave-analysis use {self}; //~ ERROR E0431 fn main () { } </ins>

<ins> error[E0431]: `self` import can only appear in an import list with a non-empty prefix --> $DIR/issue-73020.rs:2:6 | LL | use {self}; |      ^^^^ can only appear in an import list with a non-empty prefix error: aborting due to previous error For more information about this error, try `rustc --explain E0431`. </ins>

<ins> // build-pass // compile-flags: -Zsave-analysis enum Enum2 { Variant8 { _field: bool }, } impl Enum2 { fn new_variant8() -> Enum2 { Self::Variant8 { _field: true } } } fn main() {} </ins>