sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: rust
Issue: unhelpful message about reaching recursion limit because of extraneous &
Labels: C-enhancement,A-diagnostics,T-compiler,D-confusing

I tried this code:

```rust
enum Node {
    Item(Option<i32>),
    Box(Box<Node>),
}

impl Node {
    fn new() -> Self {
        Node::Item(None)
    }
    fn new_box() -> Self {
        Node::Box(Box::new(Self::new()))
    }

    fn apply<F: Fn(&i32) -> bool + Copy>(&self, f: F) -> bool {
        match &self {
            Node::Item(None) => false,
            Node::Item(Some(x)) => f(x),
            Node::Box(c) => {
                c.apply(&f) // <--- should be c.apply(f)
            }
        }
    }
}

fn main() {
    let a = Node::new_box();
    assert!(! a.apply(|x| x == &3));
}
```

I expected to see this happen: *I passed a reference to a closure rather than a closure. I would have expected to see a suggestion that I omit the `&`*

Instead, this happened: *I got the following error:*

```
error: reached the recursion limit while instantiating `Node::apply::<&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&[closure@bug.rs:27:23: 27:34]>`
  --> bug.rs:19:17
   |
19 |                 c.apply(&f) // <--- should be c.apply(f)
   |                 ^^^^^^^^^^^
   |
note: `Node::apply` defined here
  --> bug.rs:14:5
   |
14 | /     fn apply<F: Fn(&i32) -> bool + Copy>(&self, f: F) -> bool {
15 | |         match &self {
16 | |             Node::Item(None) => false,
17 | |             Node::Item(Some(x)) => f(x),
...  |
21 | |         }
22 | |     }
   | |_____^

error: aborting due to previous error
```
As I am new to rust (but have been programming since 1982), I spent a few hours narrowing my file that wouldn't compile down to this nearly minimal version when I spotted the error. The compiler, which is usually very helpful, did not give me any hint as to what was actually wrong.

`rustc --version --verbose`:
```
rustc 1.46.0 (04488afe3 2020-08-24)
binary: rustc
commit-hash: 04488afe34512aa4c33566eb16d8c912a3ae04f9
commit-date: 2020-08-24
host: x86_64-unknown-linux-gnu
release: 1.46.0
LLVM version: 10.0
```

I am brand new to rust (just started playing with it about 5 days ago), so I apologize if I have missed some step in reporting this bug, such as testing on the nightly channel (which I think I've done but I'm not entirely certain).
Repository: storybook
Issue: useEffect hook causing infinite renders in story
Labels: question / support,react

**Describe the bug**
I was trying mock the fetch using useEffect within a story but the hooks renders infinitely

**To Reproduce**
To help understand the problem I have pasted sample snippets to reproduce this problem

**Expected behavior**
Should not render after initial render. In the browser (tested in Chrome and safari), same component doesn't re-render. 

**Screenshots**
<img width="428" alt="Screenshot 2020-09-09 at 22 29 13" src="https://user-images.githubusercontent.com/12281695/92649845-ef0c0480-f2eb-11ea-82ea-b5c7f464c0bd.png">


**Code snippets**
```javascript
// Reducers
export const testInit = {
  list: [],
};

export const testReducer = (state, action) => {
  switch (action.type) {
    case 'FETCH_LIST': {
      const { list } = action.payload;
      return { ...state, list };
    }
    default:
      return state;
  }
};
```

```javascript
// Store
import { createContext } from 'react';
const TestStore = createContext();
export { TestStore };
```

```javascript
// Stories
import React, { useReducer, useContext, useEffect } from 'react';
import { testInit, testReducer } from 'reducers';
import { TestStore } from 'contexts/Store';

const mockList = [
  {
    name: 'name1',
    id: 1,
  },
  {
    name: 'name2',
    id: 2,
  },
];

const getMockedList = () =>
  new Promise((resolve) => {
    setTimeout(() => {
      resolve(mockList);
    }, 1000);
  });

export default {
  title: 'MockFetch',
  decorators: [
    (StoryFn) => {
      const [testState, dispatchTest] = useReducer(testReducer, testInit);
      return (
        <TestStore.Provider value={{ state: testState, dispatch: dispatchTest }}>
          <StoryFn />
        </TestStore.Provider>
      );
    },
  ],
};

export const MockFetch = () => {
  const Context = useContext(TestStore);

  const { dispatch } = Context;

  useEffect(() => {
    console.log('renders');
    getMockedList().then((response) => dispatch({ type: 'FETCH_LIST', payload: { list: response } }));
  }, []);
  return <p>Mock fetch</p>;
};

```

**System:**
```
Environment Info:

  System:
    OS: macOS 10.15.6
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
  Binaries:
    Node: 14.3.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.8 - ~/Documents/Backend/client/node_modules/.bin/npm
  Browsers:
    Chrome: 85.0.4183.83
    Firefox: 78.0.2
    Safari: 13.1.2
  npmPackages:
    @storybook/addon-actions: ^6.0.21 => 6.0.20 
    @storybook/addon-docs: ^6.0.21 => 6.0.20 
    @storybook/addon-links: ^6.0.21 => 6.0.20 
    @storybook/addon-storyshots: ^6.0.21 => 6.0.20 
    @storybook/addon-storysource: ^6.0.21 => 6.0.20 
    @storybook/addon-viewport: ^6.0.21 => 6.0.20 
    @storybook/addons: ^5.3.21 => 5.3.21 
    @storybook/preset-create-react-app: ^3.1.4 => 3.1.4 
    @storybook/react: ^6.0.21 => 6.0.20 
    @storybook/theming: ^5.3.21 => 5.3.21 
```

**Additional context**
Not seeing this problem in the browser
Repository: pytorch
Issue: [tools.codegen] Rename api.legacy_dispatcher to api.native
Labels: module: internals,triaged

api.native seems more descriptive than api.legacy_dispatcher. The original idea was that legacy_dispatcher types are the types that are used by the dispatcher when legacy is not in effect. But actually, these types coincide exactly with the types of the native functions people write. This is supported by the generator code for NativeFunctions.h which predeclares all native functions:

```
# Generates NativeFunctions.h, a list of forward declarations of all
# actual kernel definitions we keep in aten/src/ATen/native/
@with_native_function
def compute_native_function_declaration(f: NativeFunction) -> List[str]:
    if f.dispatch is None:
        ns = [cpp.name(f.func)]
    else:
        ns = list(f.dispatch.values())

    rs = []
    # Sometimes a function name shows up multiple times; only generate
    # it once!
    seen = set()
    for n in ns:
        if n in seen:
            continue
        if "legacy::" in n:
            continue
        seen.add(n)
        returns_type = legacy_dispatcher.returns_type(f.func.returns)
        args = legacy_dispatcher.arguments(f.func)
        rs.append(f"CAFFE2_API {returns_type} {n}({', '.join(map(lambda a: a.str_with_default(), args))});")

    return rs
```

It seems like it would be a lot clearer if we replaced `legacy_dispatcher` here with `native`.

cc @ezyang @bhosmer @smessmer @ljk53
Repository: flutter
Issue: Ctrl+F support, finding text on a page (even when scrolled off screen)
Labels: c: new feature,framework,a: fidelity,f: scrolling,platform-web,P3,team-framework,triaged-framework

Current status: https://github.com/flutter/flutter/issues/65504#issuecomment-1475059683

---

cannot browser search (CTRL +F) to find text on a page
Repository: pytorch
Issue: Support for CUDA matrix multiplication on long (and other integer) tensors
Labels: high priority,module: cuda,triaged,module: cublas,module: linear algebra,needs design,function request

## 🚀 Feature
I would love cuda support for matrix multiplication on Long Tensor
Currently:
```python
import torch

x = torch.LongTensor([[1]])
x = x.cuda()
x + x  # works
x * x  # works
x @ x  # FAILS
```
```
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-4-9e618e2c8f3b> in <module>()
      3 x = torch.LongTensor([[1]])
      4 x = x.cuda()
----> 5 x @ x

RuntimeError: "addmm_cuda" not implemented for 'Long'
```

## Motivation & Pitch

I'm working on privacy preserving machine learning which uses a lot LongTensors (like the CrypTen team cc @ezyang @gchanan @zou3519 @bdhirsh @jbschlosser @anjali411 @Varal7 @csarofeen @ptrblck @xwang233 @ngimel @jianyuh @nikitaved @pearu @mruberry @heitorschueroff @walterddr @IvanYashchuk @Lezcano @vishwakftw @vincentqb @jspisak ), and having matmul accelerated with cuda (like it is for normal matmul on floats) would be game changing.

Is there any plan to support this, or any work around?

Thanks a lot for all the efforts.
Repository: go
Issue: cmd/go: "mod why" should show all the paths to a package or module
Labels: NeedsInvestigation,FeatureRequest,GoCommand,modules,Tools

It would be nicer if `go mod why` gave all the paths to a package or module, not just the shortest path. This would help answer common questions like "what would it take to remove dependency X?".

I can get that information indirectly via `go list -deps -json` or `go mod graph`, processing or plotting the output somehow. Or even using third party tools like https://github.com/loov/goda.

Still, I think this rather simple change would make `go mod why` significantly more useful for simple use cases, without having to go to something much more involved like a graph or a dependency query language.
Repository: TypeScript
Issue: Support additional trace points
Labels: Rescheduled

## Search Terms

Tracing, Logging

## Suggestion

In addition to the trace points introduced in #40063, we've had requests for optional tracing of 

 - [ ] inferTypesFrom
 - [ ] invokeOnce
 - [ ] getAccessibleSymbolChain
 - [ ] typeToTypeNode
 - [ ] getIntersectionType
 - [ ] getUnionType
 - [ ] instantiateType

As a result, we will also require a mechanism for indicating which are active in any given run.  (Consider mimicking the format used by the `debug` package.)  However, the default should probably remain similar to what's in `#40063` since performance analysis is the primary use case.
Repository: angular
Issue: Angular Element is not removed and readded to the DOM properly
Labels: type: bug/fix,freq2: medium,hotlist: google,area: elements,state: has PR,state: confirmed,P3

# 🐞 bug report

### Affected Package

The issue is caused by package @angular/elements

### Is this a regression?

No

### Description

When an Angular Element is detached from the DOM and then re-attached, none of the event bindings work (see minimal reproduction for demo). I am a Google engineer and this is causing issues for us (internal bug filed here: http://b/168062117).

I talked to @kseamon about this and he thinks the issue is located in either of these 2 places:

https://github.com/angular/angular/blob/a69507a0adc0e559d152eb3fb988a410ef9352a7/packages/elements/src/create-custom-element.ts#L219

https://github.com/angular/angular/blob/a69507a0adc0e559d152eb3fb988a410ef9352a7/packages/elements/src/component-factory-strategy.ts#L109-L125

Specifically, `this.scheduledDestroyFn` in not set to `null` in the scheduled destroy and so may be called again upon connect. I'm testing adding one line to see if it fixes the immediate issue.

However, even with this fix, there will still exist a tiny race condition that occurs when an element is scheduled to be destroyed and then connects before the destroy executes.

## 🔬 Minimal Reproduction

https://stackblitz.com/edit/angular-ovchwr?file=src%2Findex.html

## 🔥 Exception or Error

No user-visible exception

## 🌍  Your Environment

**Angular Version:**

I'm running it against the latest Angular in google3.
Repository: TypeScript
Issue: Refine tracing functionality
Labels: Infrastructure,Domain: Performance,Rescheduled

## Search Terms

Tracing, Logging

## Suggestion

Further improvements on #40460:

 - [x] Tracing from tsserver
 - [x] Post-processing script to handle size & unterminated dumps
 - [x] Optimize `tracing._` calls (done via `tracing?._`)
 - [x] Using sampling to reduce tracing costs
 - [ ] Possibly use a proper sampling (worker) thread
   - [ ] Filter include/exclude command-line selection (not needed if sampling thread works)
 - [ ] Adjust expression source locations in post processing script
 - [ ] Improve UI by embedding tracing as a library (since there are no better visualizers)
 - [ ] Consolidating data and metadata into a single file
 - [ ] Enabling streaming gzip?
Repository: PowerToys
Issue: Shortcut Key to Open PowerToys Settings
Labels: Idea-Enhancement,Product-Settings

## 📝 Provide a description of the new feature

Instead of searching for PowerToys to open it and then opening the settings menu from the tray, create a universal shortcut key to open PowerToys after a restart, etc.

---

If you'd like to see this feature implemented, add a 👍 reaction to this post.
Repository: scrcpy
Issue: Keyboard events issue
Labels: keyboard

I'm not sure if that's SDL or of this project, bug, but:

On Linux/Ubuntu, when you start application with unicode keyboard layout, KEYUP/KEYDOWN events contain keycodes (both sym and scancode) which are >256, even if you change layout while application is running. However if you run application having english layout selected, even if you change layout, you only get codes <256 in KEYUP/KEYDOWN. That leads to errors when sometimes your input is going to screen of the device 2 times per key press, and sometimes - 0 times.

TEXT events contain right symbols, so `prefer-text` would be good workaround.

@rom1v do you handle this SDL thing correctly? Is that their known behavior?

```
$ sdl2-config --version
2.0.8
```
Repository: pytorch
Issue: [jit] class type optional type annotation not working properly 
Labels: oncall: jit

```python
from typing import Optional
import torch


@torch.jit.script
class MultiDeviceTensor:
    cpu_tensor: Optional[torch.Tensor]
    """ 
    MultiDeviceTensor holds 1) one Cuda tensor and one CPU tensor or 2) one CPU tensor
    """
    def __init__(self, tensor: torch.Tensor, tensor_extra: Optional[torch.Tensor] = None):
        self.tensor = tensor
        # self.cpu_tensor = torch.jit.annotate(Optional[torch.Tensor], None)
        self.cpu_tensor: Optional[torch.Tensor] = None
        if tensor.is_cuda and tensor_extra is not None:
            self.cpu_tensor = tensor_extra

```
gives 

```
  File "/scratch/wanchaol/pytorch/torch/jit/_script.py", line 919, in script
    _compile_and_register_class(obj, _rcb, qualified_name)
  File "/scratch/wanchaol/pytorch/torch/jit/_script.py", line 63, in _compile_and_register_class
    torch._C._jit_script_class_compile(qualified_name, ast, rcb)
RuntimeError: 
Wrong type for attribute assignment. Expected None but got Tensor:
  File "/scratch/wanchaol/pytorch/test/jit/test_class_type.py", line 1022

                if tensor1 > tensor2:
                    self.tensor = torch.randn(3, 4)
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
```



cc @gmagogsfm
Repository: flutter
Issue: Scale flutter on linux Xorg based on Xft.dpi
Labels: platform-linux,c: proposal,a: desktop,P3,team-linux,triaged-linux

## Use case

Gtk only supports integer scaling.So,the flutter view can be scaled by any fraction using Xft.dpi. 

## Proposal

Do scaling for flutter in Xorg based on Xft.dpi just like Chromium,Electron,etc.
Repository: opencv
Issue: ML Model Files FileStorage Memory Consumption
Labels: optimization,category: core

I have a very large ML model file (xml/yaml/json approx 300MB and with .gz ~30MB).
When I load the file with `FileStorage` (before loading it into the ML model), the app consumes over 1GB of memory.
Once the ML model is initialized and the file is released, the memory consumption drops to about 200MB (more difficult to measure).
My app needs to run on 32-bit machines and this memory consumption spike is causing out-of-memory problems on these older machines. 
I think the additional memory is due to `FileStorage` maintaining the dynamic hierarchical structure of the file and not so much the actual data. 
Is there a (portable) way to store and load the ML model so that loading them will not consume so much memory?
Repository: rust
Issue: Tracking Issue for complex generic constants: `feature(generic_const_exprs)`
Labels: T-lang,T-compiler,C-tracking-issue,A-const-generics,F-generic_const_exprs,S-tracking-impl-incomplete

This is a tracking issue for complex generic expressions in constants which is still highly experimental.
The feature gate for the issue is `#![feature(generic_const_exprs)]`.

On stable all const generic arguments must be either:
- A fully concrete expression using no generic parameters, e.g. `Foo<{ bar(1 + 2) }`
- A bare usage of a const parameter, e.g. `Foo<{ N }>`

This feature allows arbitrary usage of generic parameters in const generic arguments such that `Foo<{ bar(N + 2) }>` is now legal.

Initial proposal: https://github.com/rust-lang/compiler-team/issues/340
Design document: [HackMD document](https://hackmd.io/OZG_XiLFRs2Xmw5s39jRzA?view)


### About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however *not* meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

### Status

The design questions and implementation challenges are collected in the [project-const-generics repository](https://github.com/rust-lang/project-const-generics/issues?q=is%3Aissue+is%3Aopen+label%3AC-design-docs+label%3AA-generic-exprs). The implementation is still far from ready but already available for experimentation.
Repository: rust
Issue: [ER] Better suggestions for wrong attempts of giving a struct method as argument to another method
Labels: C-enhancement,A-diagnostics,T-compiler,D-newcomer-roadblock

This is an Enhancement Request regarding the Rust discoverability (for 2021). This is a naive attempt to pass a method as argument to another method:

```rust
struct Foo { y: u32 }

impl Foo {
    fn bar(&self, x: u32) {
        println!("{}", self.y + x);
    }

    fn spam(&self, f: impl Fn(u32)) {
        f(5);
    }
}

fn main() {
    let f = Foo { y: 10 };
    f.spam(&f.bar);
}
```

The error message are nearly useless:

```rust
error[E0615]: attempted to take value of method `bar` on type `Foo`
  --> C:\lavoro\bugs\temp.rs:15:15
   |
15 |     f.spam(&f.bar);
   |               ^^^ method, not a field
   |
help: use parentheses to call the method
   |
15 |     f.spam(&f.bar(_));
   |                  ^^^

error: aborting due to previous error
```

A slightly less naive attempt where the programmer remembers that member functions have the first self argument:

```rust
struct Foo { y: u32 }

impl Foo {
    fn bar(&self, x: u32) {
        println!("{}", self.y + x);
    }

    fn spam(&self, f: impl Fn(&Self, u32)) {
        f(self, 5);
    }
}

fn main() {
    let f = Foo { y: 10 };
    f.spam(&f.bar);
}
```

Rust gives similar error messages:

```rust
error[E0615]: attempted to take value of method `bar` on type `Foo`
  --> C:\lavoro\bugs\temp2.rs:15:15
   |
15 |     f.spam(&f.bar);
   |               ^^^ method, not a field
   |
help: use parentheses to call the method
   |
15 |     f.spam(&f.bar(_));
   |                  ^^^

error: aborting due to previous error
```

The programmer could receive error messages that lead to code that passes a closure:

```rust
struct Foo { y: u32 }

impl Foo {
    fn bar(&self, x: u32) {
        println!("{}", self.y + x);
    }

    fn spam(&self, f: impl Fn(u32)) {
        f(5);
    }
}

fn main() {
    let f = Foo { y: 10 };
    f.spam(|x| f.bar(x));
}
```

Or something like this, where self is given inside spam():

```rust
struct Foo { y: u32 }

impl Foo {
    fn bar(&self, x: u32) {
        println!("{}", self.y + x);
    }

    fn spam(&self, f: impl Fn(&Self, u32)) {
        f(self, 5);
    }
}

fn main() {
    let f = Foo { y: 10 };
    f.spam(Foo::bar);
}
```
Repository: rust
Issue: Invalid error while using Debug as trait:
Labels: A-diagnostics,T-compiler,C-bug,A-suggestion-diagnostics,D-invalid-suggestion

I tried this a code that did not implemented the Debug trait, and it failed correctly:
```
/data/Projects/adventofcode on  master! ⌚ 12:09:49
$ cargo run --bin advent_of_code_06 -- --filename src/bin/input_06.txt
   Compiling adventofcode v0.1.0 (/data/Projects/adventofcode)
error[E0277]: `T` doesn't implement `Debug`
  --> src/bin/advent_of_code_06.rs:48:33
   |
48 |                 print!("{:?},", self.m[ (i * self.len) + e]);
   |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug`
   |
   = note: required by `std::fmt::Debug::fmt`
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound
   |
43 | impl<T: Sized + PartialEq + Debug> Matrix<T> {
   |                           ^^^^^^^

error: aborting due to previous error
```

Looking at the line 43 of my output, the one that asks me to add the `+ Debug` to the line:

```
error[E0404]: expected trait, found derive macro `Debug`
  --> src/bin/advent_of_code_06.rs:43:29
   |
43 | impl<T: Sized + PartialEq + Debug> Matrix<T> {
   |                             ^^^^^ not a trait
   |
```

The compiler should tell me the correct Trait missing, and not  one that will not work during compilation.
I solved this by setting the trait to be `std::fmt::Debug` instead of `Debug`

`rustc --version --verbose`:
```
$ rustc --version --verbose
rustc 1.48.0-nightly (5099914a1 2020-09-08)
binary: rustc
commit-hash: 5099914a16a215794ad243df0cc7a05d91d168e0
commit-date: 2020-09-08
host: x86_64-unknown-linux-gnu
release: 1.48.0-nightly
LLVM version: 11.0
```
Repository: go
Issue: x/pkgsite: support viewing a package @ default branch HEAD
Labels: help wanted,NeedsInvestigation,pkgsite

Previously, #36811 added support for viewing packages at master on pkg.go.dev. Many repos are moving their default branch names away from master to main or something-else-not-master.

It seems that [master is hard-coded](https://github.com/golang/pkgsite/blob/97f6af5c05b8660bfd394820ce97fcc929215ae3/internal/discovery.go#L24) in pkgsite. 

Would it be possible to support some kind of magic version string that gets the default branch, whatever it may be named? This may end up being the reason that I move some of my repos back to `master`, which I'd like to avoid.

See also [this comment as FYI](https://github.com/golang/go/issues/36811#issuecomment-690122733)

cc @julieqiu
Repository: godot
Issue: Tilemap requires select to be used twice when selecting single cell
Labels: bug,topic:editor

**Godot version:**
3.2.2 stable


**OS/device including version:**
linux mint


**Issue description:**
In a tilemap, when you select a cells region using the Select(m) tool all is well. When you select a single cell it creates a cell region using the start point of the last cell you ever selected going to the single cell you selected. You then have to go into select mode again and select the single cell for it to be selected. As per animated gif and steps below.

![tilemapbug](https://user-images.githubusercontent.com/12863685/92726069-f6232900-f364-11ea-9606-63601cc30577.gif)


**Steps to reproduce:**
1. Enter select mode and select a region of cells
2. Enter select mode and click on a single cell - a region of cells appears
3. Enter select mode and click on the single cell again - it then works