profile
viewpoint
varkor varkor https://varkor.github.io/blog/ Type theorist and Rust compiler developer.

varkor/DISTORT 3

A small game demonstrating a grid distortion effect

varkor/Epilog 3

A toy Prolog compiler

ocrawford555/teamOscarSSE 2

Simulated Stock Exchange for Part IB Group Project

varkor/blog 1

A small blog about type theory and mathematics

varkor/chalk 1

A PROLOG-ish interpreter written in Rust, intended eventually for use in the compiler

varkor/acs-category-theory-notes-2017 0

Cambridge ACS Category Theory, Type Theory, and Logic - lecture notes 2017.

varkor/bitflags 0

A macro to generate structures which behave like bitflags

varkor/book 0

The Rust Programming Language

push eventvarkor/rust

varkor

commit sha ac1454001cee3f344a1104fd0cf4012b93443b0b

Suggest expressions that look like const generic arguments should be enclosed in brackets Co-Authored-By: Esteban Kuber <github@kuber.com.ar>

view details

push time in 2 hours

issue commentrust-lang/lang-team

const-generics

In the past, there have been various "procedural RFCs" that specify functionality that has already been deemed desirable, and therefore not required the full comment period (e.g. https://github.com/rust-lang/rfcs/pull/2300, https://github.com/rust-lang/rfcs/pull/2591). Perhaps this is another such situation.

nikomatsakis

comment created time in 4 hours

Pull request review commentrust-lang/rust

Add a description of `rust_ast::ast::ItemKind`

 impl Default for FnHeader {     } } +/// Represents a concrete type and contains information specific to the type of the item.

An item isn't a type: it's some kind of definition or statement. I'm not quite sure what the best description of it is, but whatever it is, it should go on struct Item, not ItemKind, which follows the same convention as all the other *Kind types.

pierwill

comment created time in 4 hours

PullRequestReviewEvent

pull request commentrust-lang/rust

Tweak invalid `fn` header and body parsing

r=me with typo fix.

estebank

comment created time in a day

Pull request review commentrust-lang/rust

Tweak invalid `fn` header and body parsing

 // Verify that '>' is not both expected and found at the same time, as it used // to happen in #24780. For example, following should be an error:-// expected one of ..., `>`, ... found `>`+// expected one of ..., `>`, ... found `>`. No longer exaclty this, but keeping for posterity.
// expected one of ..., `>`, ... found `>`. No longer exactly this, but keeping for posterity.
estebank

comment created time in a day

PullRequestReviewEvent

Pull request review commentrust-lang/rust

suggest turbofish syntax for uninferred const arguments

 impl<'a, 'tcx> InferCtxt<'a, 'tcx> {             .any(|span_label| span_label.label.is_some() && span_label.span == span)             && local_visitor.found_arg_pattern.is_none()         {+            let (kind_str, const_value) = match arg.unpack() {+                GenericArgKind::Type(_) => ("type", None),+                GenericArgKind::Const(_) => ("the value", Some(())),+                GenericArgKind::Lifetime(_) => bug!("unexpected lifetime"),+            };++            if let Some(suggestion) = const_value

It will take more investigation than I have time for. If you address my other comments, and add a FIXME(const_generics) comment explaining that we'd like to integrate this with the handling for type arguments, that should suffice for now.

Stupremee

comment created time in a day

PullRequestReviewEvent

push eventvarkor/rust

varkor

commit sha 9aa3cfba7c13cc4be2fd27b0c3d3c2f50a73efa9

Add tests for const arguments with `>` in them

view details

push time in a day

pull request commentrust-lang/rust

Suggest that expressions that look like const generic arguments should be enclosed in brackets

@petrochenkov: I've added some more tests. The error messages in these cases are not ideal, but they're particularly difficult to handle well.

varkor

comment created time in a day

push eventvarkor/rust

varkor

commit sha fdcb496aba6afb10e149ee7f99242091fc186984

No backticks around `const`

view details

varkor

commit sha 81c7c509d364c1f69efbafbd879a91aba2b531fb

Pull out `expr_is_valid_const_arg`

view details

varkor

commit sha e4f2b917dcc59316366afee1b0ac68ec1bb21354

Add tests for const arguments with `>` in them

view details

push time in a day

pull request commentrust-lang/rust

Simplify query proc-macros

Though this looks fine to me, I don't feel familiar enough with the query system to approve this. Sorry for taking so long to get to this.

r? @oli-obk

cjgillot

comment created time in 3 days

issue commentrust-lang/rust

Discussion about when to quote word with backtick

I agree that "struct" is a noun distinct from "structure", though "structure" is obviously the etymology. A struct in Rust is an algebraic data type. Putting it in backticks is no more correct, and is less readable.

lzutao

comment created time in 4 days

pull request commentrust-lang/rust

improve const infer error

@bors r+ rollup

lcnr

comment created time in 4 days

Pull request review commentrust-lang/rust

improve const infer error

 impl<'tcx> UnifyValue for ConstVarValue<'tcx> {                 // universe is the minimum of the two universes, because that is                 // the one which contains the fewest names in scope.                 let universe = cmp::min(universe1, universe2);-                (ConstVariableValue::Unknown { universe }, value1.origin.span)+                (ConstVariableValue::Unknown { universe }, value1.origin)

Hmm, I was basing my assumption off https://github.com/rust-lang/rust/blob/d1c2815d6aa131182aa93603de215d63c52d0c53/compiler/rustc_infer/src/infer/type_variable.rs#L482-L494 which doesn't keep track of span information, but it's not important either way.

lcnr

comment created time in 4 days

PullRequestReviewEvent

pull request commentrust-lang/rust

Skip most of `create_substs_for_ast_path` if type is not generic

It looks like an improvement on serde, alloc and a couple of others to me. Am I misreading the results?

bugadani

comment created time in 4 days

Pull request review commentrust-lang/rust

Fix control flow check for breaking with diverging values

+#![feature(never_type)]++fn loop_break_return() -> i32 {+    let loop_value = loop { break return 0 }; // ok+}++fn loop_break_loop() -> i32 {+    let loop_value = loop { break loop {} }; // ok+}++fn loop_break_break() -> i32 { //~ ERROR mismatched types+    let loop_value = loop { break break };+}++fn loop_break_return_2() -> i32 { //~ ERROR mismatched types+    let loop_value = loop { break { return; () } };

That did fix it, thanks both. I added the test and it's working as expected now.

varkor

comment created time in 4 days

PullRequestReviewEvent

push eventvarkor/rust

varkor

commit sha d1c2815d6aa131182aa93603de215d63c52d0c53

Use `diverges` instead of `!`-type

view details

push time in 4 days

Pull request review commentrust-lang/rust

improve const infer error

 impl<'tcx> UnifyValue for ConstVarValue<'tcx> {     type Error = (&'tcx ty::Const<'tcx>, &'tcx ty::Const<'tcx>);      fn unify_values(value1: &Self, value2: &Self) -> Result<Self, Self::Error> {-        let (val, span) = match (value1.val, value2.val) {+        let (val, origin) = match (value1.val, value2.val) {             (ConstVariableValue::Known { .. }, ConstVariableValue::Known { .. }) => {                 bug!("equating two const variables, both of which have known values")             }              // If one side is known, prefer that one.             (ConstVariableValue::Known { .. }, ConstVariableValue::Unknown { .. }) => {-                (value1.val, value1.origin.span)+                (value1.val, value1.origin)

I think we should instead just return value1 here (and likewise for value2).

lcnr

comment created time in 4 days

Pull request review commentrust-lang/rust

improve const infer error

 impl<'tcx> UnifyValue for ConstVarValue<'tcx> {                 // universe is the minimum of the two universes, because that is                 // the one which contains the fewest names in scope.                 let universe = cmp::min(universe1, universe2);-                (ConstVariableValue::Unknown { universe }, value1.origin.span)+                (ConstVariableValue::Unknown { universe }, value1.origin)

And inline the ConstVarValue { .. } part here. I don't even think the span should be relevant here, so maybe DUMMY_SP would be more semantic.

lcnr

comment created time in 4 days

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentrust-lang/rust

suggest turbofish syntax for uninferred const arguments

 impl<'a, 'tcx> InferCtxt<'a, 'tcx> {             .any(|span_label| span_label.label.is_some() && span_label.span == span)             && local_visitor.found_arg_pattern.is_none()         {+            let (kind_str, const_value) = match arg.unpack() {+                GenericArgKind::Type(_) => ("type", None),+                GenericArgKind::Const(_) => ("the value", Some(())),+                GenericArgKind::Lifetime(_) => bug!("unexpected lifetime"),+            };++            if let Some(suggestion) = const_value

Okay, let me take a better look and get back to you.

Stupremee

comment created time in 4 days

PullRequestReviewEvent

issue commentrust-lang/rust

Incorrectly typed `for` expression when into_iter expression diverges.

The special case is described here: https://github.com/rust-lang/rust/blob/d415fae8b76cddbcd7825cb6642186a833453b3c/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs#L598-L613

adlerd

comment created time in 4 days

Pull request review commentrust-lang/rust

Fix control flow check for breaking with diverging values

+#![feature(never_type)]++fn loop_break_return() -> i32 {+    let loop_value = loop { break return 0 }; // ok+}++fn loop_break_loop() -> i32 {+    let loop_value = loop { break loop {} }; // ok+}++fn loop_break_break() -> i32 { //~ ERROR mismatched types+    let loop_value = loop { break break };+}++fn loop_break_return_2() -> i32 { //~ ERROR mismatched types+    let loop_value = loop { break { return; () } };

I agree. However, apparently break { return 0 } (and your example) behave differently than break return 0, so I shall have to investigate.

varkor

comment created time in 4 days

PullRequestReviewEvent

issue commentrust-lang/rust

Incorrectly typed `for` expression when into_iter expression diverges.

My suspicion is as you say, @adlerd: that people often write return x; and this would break existing code if it was no longer inferred to be !. This must be special-cased somewhere, though I'm not sure where off the top of my head. If there are other inconsistencies, I'd be tempted to change something, but if this is a single special-case, that's probably okay.

adlerd

comment created time in 4 days

pull request commentrust-lang/rust

Add regression test for #73298

Interesting. We hadn't encountered that error before.

varkor

comment created time in 4 days

issue commentrust-lang/rust

Incorrectly typed `for` expression when into_iter expression diverges.

I have mixed feelings about this. I think this should work if and only if the following works:

fn foo() -> ! {
    return panic!();
    ()
}

which currently does not work. We tend not to use ! to determine control flow, but I'm not sure if that is a deliberate decision.

adlerd

comment created time in 4 days

issue closedrust-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>

closed time in 4 days

matthiaskrgr

issue commentrust-lang/rust

ICE: const-generics-demangling.rs

Closing as working as expected.

matthiaskrgr

comment created time in 4 days

pull request commentrust-lang/rust

Rename `overlapping_patterns` lint

@rust-lang/lang: this renames overlapping_patterns to overlapping_range_endpoints to address the confusing description of the lint, as discussed in https://github.com/rust-lang/rust/issues/65477. This probably requires an FCP, or a sign-off.

The implementation itself looks fine.

Nadrieril

comment created time in 4 days

issue commentrust-lang/rust

ICE: const-generics-demangling.rs

v0 demangling has support for const generics, but the legacy demangler does not. I was under the impression we did not need to support the legacy demangler, but I shall check.

matthiaskrgr

comment created time in 4 days

issue commentrust-lang/rust

Value mangling

Signed integers and char are now supported: https://github.com/rust-lang/rust/pull/77554, so marking this as unblocking.

varkor

comment created time in 4 days

Pull request review commentrust-lang/rust

Dogfood {exclusive,half-open} ranges in compiler (nfc)

 impl<'tcx> LateLintPass<'tcx> for UnusedResults {                 }                 ty::Array(ty, len) => match len.try_eval_usize(cx.tcx, cx.param_env) {                     // If the array is definitely non-empty, we can do `#[must_use]` checking.-                    Some(n) if n != 0 => {+                    Some(n @ 1..) => {

This is quite cute, but I'm not sure it's more readable. I'd like to hear what others think.

workingjubilee

comment created time in 4 days

PullRequestReviewEvent

Pull request review commentrust-lang/rust

Explain where the closure return type was inferred

 LL |         5    |    = note: expected type `std::result::Result<{integer}, _>`               found type `{integer}`+note: return type inferred to `std::result::Result<{integer}, _>` here
note: return type inferred to be `std::result::Result<{integer}, _>` here
Aaron1011

comment created time in 4 days

Pull request review commentrust-lang/rust

Explain where the closure return type was inferred

 impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> {         if let (Some(sp), Some(fn_output)) = (fcx.ret_coercion_span.borrow().as_ref(), fn_output) {             self.add_impl_trait_explanation(&mut err, cause, fcx, expected, *sp, fn_output);         }++        if let Some(sp) = fcx.ret_coercion_span.borrow().as_ref() {+            // If the closure has an explicit return type annotation,+            // then a type error may occur at the first return expression we+            // see in the closure (if it conflicts with the declared+            // return type). Skip adding a note in this case, since it+            // would be incorrect.+            if !err.span.primary_spans().iter().any(|span| span == sp) {+                let hir = fcx.tcx.hir();+                let body_owner = hir.body_owned_by(hir.enclosing_body_owner(fcx.body_id));+                if fcx.tcx.is_closure(hir.body_owner_def_id(body_owner).to_def_id()) {+                    err.span_note(+                        *sp,+                        &format!(+                            "return type inferred to `{}` here",
                            "return type inferred to be `{}` here",
Aaron1011

comment created time in 4 days

Pull request review commentrust-lang/rust

Explain where the closure return type was inferred

+error[E0308]: mismatched types+  --> $DIR/closure-return-type-mismatch.rs:7:9+   |+LL |         a+   |         ^ expected `&str`, found `bool`+   |+note: return type inferred to `&str` here
note: return type inferred to be `&str` here
Aaron1011

comment created time in 4 days

PullRequestReviewEvent
PullRequestReviewEvent

pull request commentrust-lang/rust

Mark `repr128` as `incomplete_features`

@bors r=jonas-schievink

varkor

comment created time in 4 days

push eventvarkor/rust

Guillaume Gomez

commit sha 6163d892248a2af02b36a0121bb5bf02a5566d2b

Improve code

view details

Guillaume Gomez

commit sha b2321bb8da18c753fe3b9b71937a368ae42b8c4b

Add test for invalid_html_tag lint in deny(rustdoc)

view details

Guillaume Gomez

commit sha 30cabfd215f374b855f6d6473b00a55c3511c3e2

Don't warn if the tag is nested inside a <script> or inside a <style>

view details

Guillaume Gomez

commit sha 5bc148957efc0bf4640d3d6b3e1824c00f1156e8

Correctly handle unicode characters and tags being open just before the end of the doc comment

view details

varkor

commit sha 488b759d5ca97c167d6a35d59d18cfb5770e70d0

Replace "non trivial" with "non-trivial"

view details

varkor

commit sha 96eb68b1216e7fa0706a999595752bfd25dca886

Add `FIXME` for const generic defaults

view details

Guillaume Gomez

commit sha ca199b16e5c06c28b3d35de79ffaaff81bd0d43f

Use char_indices() instead of chars() to prevent more than one-byte characters issue

view details

Mark Rousskov

commit sha f2961638c8b9c4494b962236aabfa9daa531f029

Place all-targets checking behind a flag This matches Cargo behavior and avoids the (somewhat expensive) double checking, as well as the unfortunate duplicate error messages (#76822, rust-lang/cargo#5128).

view details

Mark Rousskov

commit sha bcab97c12e7522c09de74f7f58a3f8e81ca2943f

Check all Cargo targets on CI

view details

bors

commit sha 738d4a7a368b4da8bfa31915f06bb1ddce9e9980

Auto merge of #74160 - CAD97:weak-as-unsized-ptr, r=RalfJung Allow Weak::as_ptr and friends for unsized T Relaxes `impl<T> Weak<T>` to `impl<T: ?Sized> Weak<T>` for the methods `rc::Weak::as_ptr`, `into_raw`, and `from_raw`. Follow-up to #73845, which did most of the impl work to make these functions work for `T: ?Sized`. We still have to adjust the implementation of `Weak::from_raw` here, however, because I missed a use of `ptr.is_null()` previously. This check was necessary when `into`/`from_raw` were first implemented, as `into_raw` returned `ptr::null()` for dangling weak. However, we now just (wrapping) offset dangling weaks' pointers the same as nondangling weak, so the null check is no longer necessary (or even hit). (I can submit just 17a928f as a separate PR if desired.) As a nice side effect, moves the `fn is_dangling` definition closer to `Weak::new`, which creates the dangling weak. This technically stabilizes that "something like `align_of_val_raw`" is possible to do. However, I believe the part of the functionality required by these methods here -- specifically, getting the alignment of a pointee from a pointer where it may be dangling iff the pointee is `Sized` -- is uncontroversial enough to stabilize these methods without a way to implement them on stable Rust. r? `@RalfJung,` who reviewed #73845. ATTN: This changes (relaxes) the (input) generic bounds on stable fn!

view details

Guillaume Gomez

commit sha d3b7b7e23a58e772194677b54672ff118ecc9093

Enforce closing HTML tags to have a ">" character

view details

varkor

commit sha 3631d2928764c0c321c60cbbe1bdd6ab5945d452

Add tests for `const_generics`

view details

ecstatic-morse

commit sha eaa0186662b0a494b2536f75f9e2811b6aa8366b

Add quotes around command in CHANGELOG

view details

varkor

commit sha 702906581e9bda1956c8adb593969196caccc2b8

Move tests

view details

Ralf Jung

commit sha 9f1861e0f86ec6687aa33a3db528d01898b8f4f5

update Miri

view details

varkor

commit sha 6647eeefb91a2f0e09f7df9f197917d22b01e846

Add `const_generics` test for `impl-trait-with-const-arguments`

view details

bors

commit sha 25c8c53dd994acb3f4f7c02fe6bb46076393f8b0

Auto merge of #77500 - RalfJung:miri, r=RalfJung update Miri Fixes https://github.com/rust-lang/rust/issues/77406 r? `@ghost` Cc `@rust-lang/miri`

view details

Jake Vossen

commit sha 018d587bc1dcd39701c12c4baefc709987f68c70

fixed going over 100 chars in line

view details

Jubilee Young

commit sha 2fcd1838ed428af379f9f91ece56f2a129466e24

Flatten arrows with further comment

view details

Stein Somers

commit sha 3b051d0171b4e15aff4d2ecacf7659f7278e8e09

BTreeMap: comment why drain_filter's size_hint is somewhat pessimistictid

view details

push time in 4 days

issue commentrust-lang/rust

Extend overlapping ranges lint to cover cases with more than a single element overlapping

overlapping_endpoints is descriptive and hopefully unambiguous or overlapping_range_endpoints.

estebank

comment created time in 5 days

issue commentrust-lang/rust

Extend overlapping ranges lint to cover cases with more than a single element overlapping

I think we should simply rename the existing lint (there's precedent for doing this, and we can warn users a lint name has changed) to make it less confusing.

estebank

comment created time in 5 days

Pull request review commentrust-lang/rust

suggest turbofish syntax for uninferred const arguments

 impl<'a, 'tcx> InferCtxt<'a, 'tcx> {             .any(|span_label| span_label.label.is_some() && span_label.span == span)             && local_visitor.found_arg_pattern.is_none()         {+            let (kind_str, const_value) = match arg.unpack() {+                GenericArgKind::Type(_) => ("type", None),+                GenericArgKind::Const(_) => ("the value", Some(())),+                GenericArgKind::Lifetime(_) => bug!("unexpected lifetime"),+            };++            if let Some(suggestion) = const_value

I think they ought to be. Could you work out why they're behaving differently. Const arguments should trigger annotate_method too.

Stupremee

comment created time in 5 days

PullRequestReviewEvent

pull request commentrust-lang/rust

Skip most of `create_substs_for_ast_path` if type is not generic

I'll double-check this soon.

bugadani

comment created time in 5 days

issue commentrust-lang/rust

Tracking Issue for `min_const_generics`

@jacobchrismarsh: thanks for offering (and sorry for taking so long to reply: it's been really busy on my end recently)! We seem to be wrapping up F-min_const_generics at the moment (all the existing issues have open PRs), so the last big thing remaining is improving the test suite coverage for the feature. We're going to plan out what kind of things we need to have tests for, and we can let you know when that's ready: we'd be eager to have help writing tests.

If you're keen to fix some bugs now, there are still a number of (non-min_)const_generics issues left. I think most of the bugs will require a little bit of investigation to fix, but there are still a few easier ones. Some examples are https://github.com/rust-lang/rust/issues/75763, https://github.com/rust-lang/rust/issues/65349 (for which there's an old PR you could revive and fix up), and https://github.com/rust-lang/rust/issues/61414. But feel free to take a look at any of the issues and comment there, and I'll try to give you pointers on how to get started!

lcnr

comment created time in 5 days

pull request commentrust-lang/rust

Add regression test for #73298

I guess we previously didn't normalize/evaluate that constant in symbol mangling?

An issue with symbol mangling was my guess, but I didn't investigate.

varkor

comment created time in 5 days

push eventvarkor/rust

varkor

commit sha 10d6f2d7ea55ec1a8bafcac23e731ac69e470f5b

Add regression test for #73298

view details

push time in 5 days

PR opened rust-lang/rust

Add regression test for #73298

Closes https://github.com/rust-lang/rust/issues/73298.

r? @lcnr

+24 -0

0 comment

1 changed file

pr created time in 5 days

create barnchvarkor/rust

branch : issue-73298

created branch time in 5 days

Pull request review commentrust-lang/rust

Fix control flow check for breaking with diverging values

 impl<'a, 'tcx> FnCtxt<'a, 'tcx> {                 assert!(expr_opt.is_none() || self.tcx.sess.has_errors());             } -            ctxt.may_break = true;+            // If we encountered a `break`, then (no surprise) it may be possible to break from the+            // loop... unless the value being returned from the loop diverges itself, e.g.+            // `break return 5` or `break loop {}`.+            ctxt.may_break |= !e_ty.is_never();

@nikomatsakis: I've added those examples, and also an analogous test with !, which behave how I would expect (i.e. return Void does not work, but returning ! does).

varkor

comment created time in 5 days

PullRequestReviewEvent

push eventvarkor/rust

Guillaume Gomez

commit sha 6163d892248a2af02b36a0121bb5bf02a5566d2b

Improve code

view details

Guillaume Gomez

commit sha b2321bb8da18c753fe3b9b71937a368ae42b8c4b

Add test for invalid_html_tag lint in deny(rustdoc)

view details

Guillaume Gomez

commit sha 30cabfd215f374b855f6d6473b00a55c3511c3e2

Don't warn if the tag is nested inside a <script> or inside a <style>

view details

Guillaume Gomez

commit sha 5bc148957efc0bf4640d3d6b3e1824c00f1156e8

Correctly handle unicode characters and tags being open just before the end of the doc comment

view details

varkor

commit sha 488b759d5ca97c167d6a35d59d18cfb5770e70d0

Replace "non trivial" with "non-trivial"

view details

varkor

commit sha 96eb68b1216e7fa0706a999595752bfd25dca886

Add `FIXME` for const generic defaults

view details

Guillaume Gomez

commit sha ca199b16e5c06c28b3d35de79ffaaff81bd0d43f

Use char_indices() instead of chars() to prevent more than one-byte characters issue

view details

Mark Rousskov

commit sha f2961638c8b9c4494b962236aabfa9daa531f029

Place all-targets checking behind a flag This matches Cargo behavior and avoids the (somewhat expensive) double checking, as well as the unfortunate duplicate error messages (#76822, rust-lang/cargo#5128).

view details

Mark Rousskov

commit sha bcab97c12e7522c09de74f7f58a3f8e81ca2943f

Check all Cargo targets on CI

view details

bors

commit sha 738d4a7a368b4da8bfa31915f06bb1ddce9e9980

Auto merge of #74160 - CAD97:weak-as-unsized-ptr, r=RalfJung Allow Weak::as_ptr and friends for unsized T Relaxes `impl<T> Weak<T>` to `impl<T: ?Sized> Weak<T>` for the methods `rc::Weak::as_ptr`, `into_raw`, and `from_raw`. Follow-up to #73845, which did most of the impl work to make these functions work for `T: ?Sized`. We still have to adjust the implementation of `Weak::from_raw` here, however, because I missed a use of `ptr.is_null()` previously. This check was necessary when `into`/`from_raw` were first implemented, as `into_raw` returned `ptr::null()` for dangling weak. However, we now just (wrapping) offset dangling weaks' pointers the same as nondangling weak, so the null check is no longer necessary (or even hit). (I can submit just 17a928f as a separate PR if desired.) As a nice side effect, moves the `fn is_dangling` definition closer to `Weak::new`, which creates the dangling weak. This technically stabilizes that "something like `align_of_val_raw`" is possible to do. However, I believe the part of the functionality required by these methods here -- specifically, getting the alignment of a pointee from a pointer where it may be dangling iff the pointee is `Sized` -- is uncontroversial enough to stabilize these methods without a way to implement them on stable Rust. r? `@RalfJung,` who reviewed #73845. ATTN: This changes (relaxes) the (input) generic bounds on stable fn!

view details

Guillaume Gomez

commit sha d3b7b7e23a58e772194677b54672ff118ecc9093

Enforce closing HTML tags to have a ">" character

view details

varkor

commit sha 3631d2928764c0c321c60cbbe1bdd6ab5945d452

Add tests for `const_generics`

view details

ecstatic-morse

commit sha eaa0186662b0a494b2536f75f9e2811b6aa8366b

Add quotes around command in CHANGELOG

view details

varkor

commit sha 702906581e9bda1956c8adb593969196caccc2b8

Move tests

view details

Ralf Jung

commit sha 9f1861e0f86ec6687aa33a3db528d01898b8f4f5

update Miri

view details

varkor

commit sha 6647eeefb91a2f0e09f7df9f197917d22b01e846

Add `const_generics` test for `impl-trait-with-const-arguments`

view details

bors

commit sha 25c8c53dd994acb3f4f7c02fe6bb46076393f8b0

Auto merge of #77500 - RalfJung:miri, r=RalfJung update Miri Fixes https://github.com/rust-lang/rust/issues/77406 r? `@ghost` Cc `@rust-lang/miri`

view details

Jake Vossen

commit sha 018d587bc1dcd39701c12c4baefc709987f68c70

fixed going over 100 chars in line

view details

Jubilee Young

commit sha 2fcd1838ed428af379f9f91ece56f2a129466e24

Flatten arrows with further comment

view details

Stein Somers

commit sha 3b051d0171b4e15aff4d2ecacf7659f7278e8e09

BTreeMap: comment why drain_filter's size_hint is somewhat pessimistictid

view details

push time in 5 days

pull request commentrust-lang/rust

Suggest that expressions that look like const generic arguments should be enclosed in brackets

@petrochenkov: I've moved the functions to diagnostics.rs.

varkor

comment created time in 5 days

pull request commentrust-lang/rust

Support signed integers and `char` in v0 mangling

@bors r=eddyb rollup

varkor

comment created time in 5 days

push eventvarkor/rust

Guillaume Gomez

commit sha 6163d892248a2af02b36a0121bb5bf02a5566d2b

Improve code

view details

Guillaume Gomez

commit sha b2321bb8da18c753fe3b9b71937a368ae42b8c4b

Add test for invalid_html_tag lint in deny(rustdoc)

view details

Guillaume Gomez

commit sha 30cabfd215f374b855f6d6473b00a55c3511c3e2

Don't warn if the tag is nested inside a <script> or inside a <style>

view details

Guillaume Gomez

commit sha 5bc148957efc0bf4640d3d6b3e1824c00f1156e8

Correctly handle unicode characters and tags being open just before the end of the doc comment

view details

varkor

commit sha 488b759d5ca97c167d6a35d59d18cfb5770e70d0

Replace "non trivial" with "non-trivial"

view details

varkor

commit sha 96eb68b1216e7fa0706a999595752bfd25dca886

Add `FIXME` for const generic defaults

view details

Guillaume Gomez

commit sha ca199b16e5c06c28b3d35de79ffaaff81bd0d43f

Use char_indices() instead of chars() to prevent more than one-byte characters issue

view details

Mark Rousskov

commit sha f2961638c8b9c4494b962236aabfa9daa531f029

Place all-targets checking behind a flag This matches Cargo behavior and avoids the (somewhat expensive) double checking, as well as the unfortunate duplicate error messages (#76822, rust-lang/cargo#5128).

view details

Mark Rousskov

commit sha bcab97c12e7522c09de74f7f58a3f8e81ca2943f

Check all Cargo targets on CI

view details

Guillaume Gomez

commit sha d3b7b7e23a58e772194677b54672ff118ecc9093

Enforce closing HTML tags to have a ">" character

view details

varkor

commit sha 3631d2928764c0c321c60cbbe1bdd6ab5945d452

Add tests for `const_generics`

view details

ecstatic-morse

commit sha eaa0186662b0a494b2536f75f9e2811b6aa8366b

Add quotes around command in CHANGELOG

view details

varkor

commit sha 702906581e9bda1956c8adb593969196caccc2b8

Move tests

view details

Ralf Jung

commit sha 9f1861e0f86ec6687aa33a3db528d01898b8f4f5

update Miri

view details

varkor

commit sha 6647eeefb91a2f0e09f7df9f197917d22b01e846

Add `const_generics` test for `impl-trait-with-const-arguments`

view details

bors

commit sha 25c8c53dd994acb3f4f7c02fe6bb46076393f8b0

Auto merge of #77500 - RalfJung:miri, r=RalfJung update Miri Fixes https://github.com/rust-lang/rust/issues/77406 r? `@ghost` Cc `@rust-lang/miri`

view details

Jake Vossen

commit sha 018d587bc1dcd39701c12c4baefc709987f68c70

fixed going over 100 chars in line

view details

Jubilee Young

commit sha 2fcd1838ed428af379f9f91ece56f2a129466e24

Flatten arrows with further comment

view details

Stein Somers

commit sha 3b051d0171b4e15aff4d2ecacf7659f7278e8e09

BTreeMap: comment why drain_filter's size_hint is somewhat pessimistictid

view details

Guillaume Gomez

commit sha 0e68e1ba5c5e67109f909fddb3530047b3d633b2

Prevent #[doc(alias = "...")] at crate level

view details

push time in 5 days

push eventvarkor/rust

varkor

commit sha c23db00f68e453b0016d8dc9994c301d4b7fad31

Move diagnostics code to `diagnostics.rs`

view details

push time in 5 days

issue commentrust-lang/rust

"error: linking with `cc` failed: exit code: 1" regression in release build with const generics

This appears to be working now. I'll add a test.

is8ac

comment created time in 5 days

push eventvarkor/rust

Mateusz Mikuła

commit sha 0ad3da06843089c0bf10d6caa3fbbc72fa67787a

Enable ASLR for windows-gnu

view details

Mark Rousskov

commit sha e023158145ece18176a2e93420600ccda0d0bc58

Permit uninhabited enums to cast into ints This essentially reverts part of #6204.

view details

Mark Rousskov

commit sha 990a39596cf3b33e550f2045f78a62970f8d78f8

Prevent ICE on uninhabited MIR interpretation

view details

Tim Nielens

commit sha 390a13b06c79d4177b829097b06453e38188081f

needless-lifetime - fix nested elision site FPs

view details

Tim Nielens

commit sha a60e5de90c7370d4fb3e6561d3cb55495cda2e2a

needless-lifetime / nested elision sites / PR remarks

view details

Tim Nielens

commit sha c8e9e52303da6dff4bc5cc4db3021d608fca6c70

needless-lifetime / add test cases for nested elision sites

view details

Takayuki Nakata

commit sha 1778a1ec4615a42a8ba9497006b07859186c08a1

Restrict `same_item_push` to suppress false positives It emits a lint when the pushed item is a literal, a constant and an immutable binding that are initialized with those.

view details

Takayuki Nakata

commit sha 0117ea2b016133145f9e02e27421ac3672b42f57

Refactoring: use inner function

view details

Takayuki Nakata

commit sha b80576fba633e1fc214c9f6900d7ca3424bda6d0

Some refactoring

view details

Takayuki Nakata

commit sha 14faebe20ea82392f393c3ff5efaab7250e51989

Add some tests to `same_item_push` Add tests in which the variable is initialized with a match expression and function call

view details

Takayuki Nakata

commit sha 2972ad3ef661071531a61ec8999b668a6b734b74

Refactoring: tests in `same_item_push`

view details

Takayuki Nakata

commit sha 730ca457f580247667ed0cd5965bc08752ebc0b3

Address `items_after_statement`

view details

Nathan West

commit sha a02014280586b53997622c501db00398376967a8

Refactor io/buffered.rs into submodules

view details

Nathan West

commit sha 96229f02402e82914ec6100b28ad2cbdd273a0d4

move buffered.rs to mod.rs

view details

Dylan MacKenzie

commit sha 72b402ed38f0c71461038aef8a49a02e49280788

Add pass names to some common dataflow analyses

view details

Nathan West

commit sha 6d75cdfc9ed9e6987bd23add6cf3954d2499dce2

Added updated compiler diagnostic

view details

Amjad Alsharafi

commit sha da700cba08a2b194d19e63d3c51ebadce96fe46b

Stabilize move_ref_pattern

view details

Amjad Alsharafi

commit sha afb9eeb1b9ea16ca65e38673a0ef3e7be81d7252

Disabled error `E0007` from rustc_error_codes

view details

Mark Rousskov

commit sha 05c9c0ee5dcd935f518db151bee2dc88380fb92f

Modify executable checking to be more universal This uses a dummy file to check if the filesystem being used supports the executable bit in general.

view details

Nathan West

commit sha c4280af8285c61b367a87c8f6eef9876011a8150

Retry fix error reporting suggestions

view details

push time in 5 days

pull request commentalexcrichton/rustc-demangle

Print `char` using `{:?}`

@alexcrichton: would you be able to publish a new version of the crate? Thanks!

varkor

comment created time in 5 days

delete branch varkor/rustc-demangle

delete branch : debug-print-char

delete time in 5 days

delete branch varkor/rustc-demangle

delete branch : min_const_generics

delete time in 5 days

pull request commentrust-lang/rust

Support signed integers and `char` in v0 mangling

I'll rebase on top of https://github.com/alexcrichton/rustc-demangle/pull/41 as soon as it's merged.

varkor

comment created time in 5 days

pull request commentrust-lang/rust

Cleanup constant matching in exhaustiveness checking

Thanks!

@bors r+

Nadrieril

comment created time in 5 days

PR opened alexcrichton/rustc-demangle

Print `char` using `{:?}`

Addresses @eddyb's comment about newlines being output as '\n', rather than an actual newline.

+20 -26

0 comment

1 changed file

pr created time in 5 days

create barnchvarkor/rustc-demangle

branch : debug-print-char

created branch time in 5 days

push eventvarkor/rustc-demangle

varkor

commit sha 7551efa82f6f00f1fe4c0aaa58707b8a83de8a27

Elide the type when the const value is a placeholder `p` (#40)

view details

Alex Crichton

commit sha 5119b5f76b2b30f7b47839837d46ffc6c9b3d6fe

Bump to 0.1.17

view details

push time in 5 days

PullRequestReviewEvent

Pull request review commentrust-lang/rust

suggest turbofish syntax for uninferred const arguments

 impl<'a, 'tcx> InferCtxt<'a, 'tcx> {             .any(|span_label| span_label.label.is_some() && span_label.span == span)             && local_visitor.found_arg_pattern.is_none()         {+            let (kind_str, const_value) = match arg.unpack() {+                GenericArgKind::Type(_) => ("type", None),+                GenericArgKind::Const(_) => ("the value", Some(())),+                GenericArgKind::Lifetime(_) => bug!("unexpected lifetime"),+            };++            if let Some(suggestion) = const_value

@Stupremee: do you know what the issue is? I would have thought you could tweak the methods to work with consts the same way they work with types.

Stupremee

comment created time in 5 days

issue commentrust-lang/rust

Nonsensical error when trying to use associated const in array

Hopefully min_const_generics will be stabilised in the not-too-distant future, so it's probably reasonable to leave this for now.

Aaron1011

comment created time in 5 days

pull request commentrust-lang/rust

Add `has_default` to `GenericParamDefKind::Const`

Sorry, things are still very busy for me. I suspect I won't get a change to look at this properly for a little while, because I'd like to focus my spare time on the min_const_generics stabilisation process. It might be worth asking on Zulip, where there are usually more people who are familiar with rustc and might be able to spot what's going wrong.

JulianKnodt

comment created time in 5 days

delete branch varkor/rust

delete branch : const-param-of-type-param

delete time in 5 days

pull request commentrust-lang/rust

Do not allow const generics to depend on type parameters

Is there a plan to allow const generics to depend on type parameters in the (near) future?

Not in the near future, but it's something we'd like to support eventually. It's not in the original RFC, though, so will require some design discussion.

varkor

comment created time in 5 days

pull request commentrust-lang/rust

Stabilize or_insert_with_key

This will needs a libs team sign-off.

r? @SimonSapin

ChaiTRex

comment created time in 5 days

pull request commentrust-lang/rust

Fix bad placeholder type error on certain consts and statics

(I will try to get back to this, but there are higher priority issues for now.)

varkor

comment created time in 5 days

pull request commentrust-lang/rust

Lift: take self by value

Implementation looks fine to me. r=me after addressing the two comments.

lcnr

comment created time in 5 days

pull request commentrust-lang/rust

Skip most of `create_substs_for_ast_path` if type is not generic

Let's check whether this makes a noticeable difference.

@bors try @rust-timer queue

bugadani

comment created time in 5 days

PullRequestReviewEvent

Pull request review commentrust-lang/rust

Cleanup constant matching in exhaustiveness checking

 fn specialize_one_pattern<'p, 'tcx>(     pat: &'p Pat<'tcx>,     constructor: &Constructor<'tcx>,     ctor_wild_subpatterns: &Fields<'p, 'tcx>,+    is_its_own_ctor: bool, // Whether `ctor` is known to be derived from `pat` ) -> Option<Fields<'p, 'tcx>> {     if let NonExhaustive = constructor {-        // Only a wildcard pattern can match the special extra constructor+        // Only a wildcard pattern can match the special extra constructor.         if !pat.is_wildcard() {             return None;         }         return Some(Fields::empty());     } +    if let Opaque = constructor {+        // Only a wildcard pattern can match an opaque constant, unless we're specializing the+        // value against its own constructor.

Could you give an example here, to explain how specialising against the construction is a special case?

Nadrieril

comment created time in 5 days

PullRequestReviewEvent

delete branch varkor/rust

delete branch : opt_const_param_of-error

delete time in 5 days

issue commentrust-lang/rust

exhaustiveness checker mishandles const reference to ADT in match pattern

(If there's already a test for this case, feel free to close again: I just want to be sure.)

hcs64

comment created time in 5 days

PR opened rust-lang/rust

Fix issue with specifying generic arguments for primitive types

Fixes https://github.com/rust-lang/rust/issues/78005.

r? @lcnr

+24 -6

0 comment

3 changed files

pr created time in 8 days

create barnchvarkor/rust

branch : opt_const_param_of-error

created branch time in 8 days

issue commentrust-lang/rust

ICE: type_of.rs:115:26: unexpected anon const res PrimTy(Uint(Usize)) in path

I just saw this issue and thought the same thing. I'm testing the fix now.

chengniansun

comment created time in 8 days

pull request commentrust-lang/rfcs

Destructuring assignment

@rust-lang/lang: this is ready to be merged. (The tracking issue already exists, so I think that's all that's left to do.)

varkor

comment created time in 8 days

pull request commentrust-lang/rust

Remove unused code

@bors r=petrochenkov,varkor

est31

comment created time in 12 days

Pull request review commentrust-lang/rust

Remove unused code

 impl Generics<'hir> {         }     } -    pub fn own_counts(&self) -> GenericParamCount {

Ah, I'm glad to see this go.

est31

comment created time in 12 days

PullRequestReviewEvent

pull request commentrust-lang/rust

Use Option::unwrap_or instead of open-coding it

@bors r+ rollup

LingMan

comment created time in 14 days

more