sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: rust
Issue: Returning unsized objects allowed in `Fn` traits but fails to compile when called
Labels: A-diagnostics,A-trait-system,T-compiler,C-bug,D-confusing

As documented in [the book](https://doc.rust-lang.org/book/ch19-05-advanced-functions-and-closures.html#returning-closures), a function cannot return an unsized object. So this function definition doesn't compile, as expected:

```rust
// #1 - error: "the return type of a function must have a statically known size"
fn returns_unsized() -> [u8] {
    todo!()
}
```

However, it is apparently possible for an `Fn` trait to return an unsized object. This compiles:

```rust
// #2 - compiles
type ReturnsUnsized = Box<dyn Fn() -> [u8]>;
fn bla(x: ReturnsUnsized) {
    todo!()
}
```

When you actually try to _use_ the type, compilation fails (which is expected), but with an error message saying "call expression requires function" without pointing out the underlying issue:

```rust
// #3 - error: "call expression requires function"
type ReturnsUnsized = Box<dyn Fn() -> [u8]>;
fn bla(x: ReturnsUnsized) {
    x();
}
```
```
error[E0618]: expected function, found `Box<(dyn Fn() -> [u8] + 'static)>`
 --> src/lib.rs:4:5
  |
3 | fn bla(x: ReturnsUnsized) {
  |        - `Box<(dyn Fn() -> [u8] + 'static)>` defined here
4 |     x();
  |     ^--
  |     |
  |     call expression requires function
```

Changing the `Fn` trait to box the returned unsized object results in successful compilation (as expected):

```rust
// #4 - compiles
type ReturnsBoxedUnsized = Box<dyn Fn() -> Box<[u8]>>;
fn bla(x: ReturnsBoxedUnsized) {
    x();
}
```

I would expect `#2` to fail to compile with a similar error like `#1`. (Or at  least to emit a warning in case an error would break compatibility in the current edition.)

More importantly, I'd expect the compiler diagnostics in `#3` (and in `#2`, should it fail to compile) to mention the underlying problem, which is returning an unsized object.

This issue was encountered by a [StackOverflow user](https://stackoverflow.com/questions/66646847/boxed-function-factory-higher-order-function-in-rust-results-in-call-expressi/66647090) who tried to declare a dynamic higher-order function as `Box<dyn Fn(f32, f32, f32, f32) -> (dyn Fn(f32) -> f32)>` (note unboxed return type) and call it. Boxing the inner closure fixed the issue, but the error message was unhelpful in diagnosing the problem.

Reproducible in the [playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=3743e2b7226c0b88d54365a0b35d5ea9) with stable, beta, and nightly compilers.

### Meta

`rustc --version`:
```
rustc 1.50.0
```
Repository: pytorch
Issue: Wrong initialisation gain for SNNs/SELU
Labels: module: nn,triaged,module: initialization

## 🐛 Bug

The default initialisation gain for the SELU activation function breaks [SNNs](https://papers.nips.cc/paper/2017/hash/5d44ee6f2c3f71b73125876103c8f6c4-Abstract.html), which explicitly require initial weights to have variance `1 / fan_in` (rather than `0.75 / fan_in`).

## To Reproduce

Steps to reproduce the behaviour:

1. Create multi-layer SNN
2. Use default initialisation
3. Print mean and variance in every layer

```python
from torch import nn

def init(m):
    if isinstance(m, nn.Linear):
        nn.init.kaiming_uniform_(m.weight, nonlinearity='selu')

layers = [30] + [100] * 20 + [10]
snn = nn.Sequential(*(
    nn.Sequential(
        nn.Linear(n_in, n_out, bias=False),
        nn.SELU(),
    ) for n_in, n_out in zip(layers[:-1], layers[1:])
))
snn.apply(init)

x = torch.randn(1000, 30)
for layer in snn:
    x = layer(x)
    print(f"{x.mean().item():.5f}, {x.var().item():.5f}")
```

## Expected behavior

Normalised activations in every layer, i.e. zero mean and unit variance. This can be obtained by using `nonlinearity='linear'`.

## Environment

 - PyTorch Version (e.g., 1.0): 1.8.0
 - OS (e.g., Linux): Linux
 - How you installed PyTorch (`conda`, `pip`, source): conda
 - Build command you used (if compiling from source):
 - Python version: 3.8

## Additional context

This issue was introduced with PR #50664 which aimed to tackle #24991. In this PR, an empirical value for the gain was chosen so that gradients "behave better" (i.e., do not grow or shrink that much). I already proposed to fix this with PR #53694, which would be BC breaking and therefore requires more incentive to be fixed. A discussion as to why it does not make sense to use the empirical value is included in my PR. The goal of this issue is therefore to provide the incentive to fix this bug by collecting upvotes for this issue.

TL;DR: Trying to collect upvotes to get this bug fixed


cc @albanD @mruberry @jbschlosser
Repository: flutter
Issue: Wrong vertical alignment of text on TextFormField widget if suffix widget is used.
Labels: a: text input,framework,f: material design,has reproducible steps,found in release: 3.0,found in release: 3.1,team-design,triaged-design

When I specify the `suffix` property for `TextFormField` the text in widget become not middle aligned by vertically. If searched on stackoverflow and found that [this issue](https://stackoverflow.com/questions/57659523/how-do-you-vertically-align-text-in-textformfield-with-a-suffix-in-flutter) is enough old. I don't mean _padding_ from left, I mean it is not aligned middle vertically. I tried to use `Padding` or `contentPadding` - it does not help.
Repository: electron
Issue: [Bug]: 'close' event is not triggered for sandboxed windows
Labels: bug :beetle:,platform/all,component/BrowserWindow,10-x-y,has-repro-gist,11-x-y,12-x-y

### Preflight Checklist

- [X] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to.
- [X] I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a feature request that matches the one I want to file, without success.

### Electron Version

12.0.1, 11.3.0, 10.4.1

### What operating system are you using?

Other Linux

### Operating System Version

`Linux workstation 5.11.6-arch1-1 #1 SMP PREEMPT Thu, 11 Mar 2021 13:48:23 +0000 x86_64 GNU/Linux`

### What arch are you using?

x64

### Last Known Working Electron version

_No response_

### Expected Behavior

[`close` event](https://www.electronjs.org/docs/api/browser-window#event-close) should be triggered when the webpage closes itself with `window.close()`, as it is for non-sandboxed contexts.

### Actual Behavior

`close` event is not triggered on `window.close()` from inside the webpage for sandboxed contexts.

### Testcase Gist URL

https://gist.github.com/cecc82a9d8ee56d01aa97b4c716eea9e

Testcase:
```js
const { app, BrowserWindow } = require('electron')
app.whenReady().then(() => {
  const win = new BrowserWindow({
    width: 800, height: 600,
    webPreferences: {
      // sandbox: false, // works
      sandbox: true, // broken
    }
  })
  win.loadFile('about:blank')
  win.on('close', () => { console.log('close') }) // not triggered if broken
  win.on('closed', () => { console.log('closed') })
  setTimeout(() => {
    win.webContents.executeJavaScript('window.close()') // broken
    // win.close() // works
  }, 0)
})
```

Here, `executeJavaScript` is not necessary -- the page can do the same itself, or that could be alternatively done from devtools.

* If the window is closed externally (via `.close()` method of `BrowserWindow` instance, or via Alt-F4 or other OS/DE method), `close` event is always triggered.

* If `sandbox` is not enabled, `close` event is always triggered.

* `closed` (as opposed to `close`) event is also triggered if the window was closed.

* If the window closes itself with `window.close()` _and_ it's sandboxed -- `close` event doesn't get triggered.
Repository: pytorch
Issue: c++ convert from std::vector<Tensor> to c10::List<optional<Tensor>>
Labels: module: docs,module: cpp,triaged

## 🚀 Feature
Give some guidance on best way to get from _std::vector<Tensor>_ to _c10::List<c10::optional<Tensor>>_
## Motivation
Pull request #49138 made indexing use _List<optional<Tensor>>_
but some tensor functions, e.g. _split_, return _vector<Tensor>_
Some clue somewhere in a header file or release notes or _test/cpp/api/tensor_indexing.cpp_ on how best to get the vector -> list would be very helpful.

The release notes detail the case for _tensor.index(i)_ to _tensor.index(**{**i**}**)_ but I couldn't find a case for _vector<Tensor>_.
_ATen/core/List_inl.h_ has a _toTypedList_ method, but it isn't clear how it's intended to be used.

Thanks.


cc @yf225 @glaringlee @brianjo @mruberry
Repository: create-react-app
Issue: Eslint/Tslint configuration included by default on installation and configurable.
Labels: issue: proposal,needs triage

### Is your proposal related to a problem?

<!--
  Provide a clear and concise description of what the problem is.
  For example, "I'm always frustrated when..."
-->

 When creating a new project with React CRA, each time you create a project you have to individually install dependencies for eslint/tslint which results in having to waste time repeating the same process of installing the dependencies.

### Describe the solution you'd like

<!--
  Provide a clear and concise description of what you want to happen.
-->

I would like to propose an out-of-the-box solution or some predefined commands, which when you create your application it installs the required dependencies for eslint/tslint depending on if you choose javascript or typescript or simply singular one for both in the config.


### Additional context

A good example of this would be the team that created NestJS, when you do nest new "project name", it installs: -

.eslint.js
.prettierrc

which then allows you to customize them out of the box.
<!--
  Is there anything else you can add about the proposal?
  You might want to link to related issues here if you haven't already.
-->
Repository: excalidraw
Issue: Improve arrow head sizing? 
Labels: enhancement,discussion

Currently, the size of the arrow head is proportional to the length of the arrow.

Is it better to make it proportional to the distance from the last edge? 

![image](https://user-images.githubusercontent.com/356014/111289557-92482880-8645-11eb-8758-32ac8570b573.png)
Repository: godot
Issue: Change text and behavior for button
Labels: discussion,topic:editor

<!-- Please search existing issues for potential duplicates before filing yours:
https://github.com/godotengine/godot/issues?q=is%3Aissue
-->

**Godot version:**
<!-- Specify commit hash if using non-official build. -->
3.2.4 RC4 mono

**OS/device including version:**
<!-- Specify GPU model, drivers, and the backend (GLES2, GLES3, Vulkan) if graphics-related. -->
win10 64

**Issue description:**
<!-- What happened, and what was expected. -->
The button shows the text "Abrir" when the intention is to select a folder in which to place a script.
The button should show "Seleccionar carpeta" and it should be enough to select the folder and click on the button (it should not be necessary to enter the folder).
Then the user simply selects a folder and clicks the button.

Currently the user must enter the folder (by double clicking, because if he selects the folder and clicks the "Abrir" button, the option will be validated but the folder will not be selected) and then press the "Abrir" button to select the folder resulting in a confusing process.

Look the GIF, the process is quite confusing.

![GIF](https://user-images.githubusercontent.com/19652075/111290757-c243fb80-8646-11eb-8107-c56c277880a7.gif)


**Steps to reproduce:**
Create a node, assign a script to it and select the folder (not enter in the folder) where you want to place the script, press the buton "Abrir" and nothing happens, double click on the folder to enter and then press the button "Abrir" then the script is created in the folder.

**Minimal reproduction project:**
<!-- A small Godot project which reproduces the issue. Drag and drop a zip archive to upload it. -->
Repository: create-react-app
Issue: SSR for CRA
Labels: issue: proposal,needs triage

We have a CRA which works perfectly fine, but have encountered a situation where we need to SSR just one route so that we can utilise the preview links on social media platforms. Everything is built using react-router, Redux and Material UI.

Is this something that will be coming soon? I've tried to use react-helmet but we have dynamic images that need to be displayed so it seems static markup is the only answer here, but obviously it's rendered n the client side. It would be good we could opt in either fully, or use SSR on an ad-hoc basis for specific routes.
Repository: pytorch
Issue: Many advanced indexing operations have untested large tensor branches
Labels: module: tests,triaged,module: advanced indexing

In the discussion in https://github.com/pytorch/pytorch/pull/53898#issuecomment-797760860 it was found that many advanced indexing operations have branches for large tensors by using `cuda::detail::canUse32BitIndexMath`. A quick grep shows that these branch are not tested in `test/test_torch.py`.

It would be interesting to add large tests for all these operations to ensure that these branches work as expected.

The amount of repeated code in these branches can become almost zero when using `TensorIterator`, so it would be, in theory, possible to almost get rid of these branches when using `TensorIterator`, but that's another story.

cc @mruberry @VitalyFedyunin @walterddr
Repository: rust
Issue: remove redundant clones via mir opt?
Labels: C-enhancement,T-compiler,A-mir-opt,C-optimization

I wonder if it is possible to have an optimization pass that removes redundant clones if we know that `.clone()` does not do anything funky and that the original object would have been untouched and dropped  in the same block where it was cloned.

There's a clippy lint which tries to warn about useless clones https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone



The pass could optimize something like
````rust
#[derive(Clone)]
pub struct S {
    inner: String,
}

pub fn a(a: S) -> S {
    a.clone()
}
````
to
````rust
#[derive(Clone)]
pub struct S {
    inner: String,
}

pub fn a(a: S) -> S {
    a // just return the object
}
````
Repository: react-native
Issue: Components inside the Text wont follow the width of the Text when screen Orientation is changed
Labels: Issue: Author Provided Repro,Component: Text

## Description
So I implement `AdMobBanner` and then decided to place is inside the `Text` component.
Why I did that, Well I have `AdMobBanner` inside `TouchableOpacity` component and if I do not place it inside the `Text`, the user wont be able to click on it.

Now this is not the problem, the problem is that when the screen Orientation is changed the component inside the `Text` wont follow for some reason.



## React Native version:
```
System:
    OS: Windows 10 10.0.19042
    CPU: (8) x64 Intel(R) Core(TM) i7-3820 CPU @ 3.60GHz
    Memory: 1.13 GB / 7.92 GB
  Binaries:
    Node: 15.6.0 - C:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 6.14.11 - D:\Projects\NovelManager\node_modules\.bin\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK:
      API Levels: 26, 28, 29, 30
      Build Tools: 28.0.3, 29.0.2, 30.0.3
      System Images: android-30 | Google APIs Intel x86 Atom
      Android NDK: Not Found
    Windows SDK: Not Found
  IDEs:
    Android Studio: Not Found
    Visual Studio: 16.7.30517.126 (Visual Studio Enterprise 2019)
  Languages:
    Java: 11.0.10 - C:\Program Files\AdoptOpenJDK\jdk-11.0.10.9-hotspot\bin\javac.EXE
    Python: 3.9.1 - C:\Python39\python.EXE
  npmPackages:
    @react-native-community/cli: Not Found
    react: ~16.13.1 => 16.13.1
    react-native: ^0.63.4 => 0.63.4
    react-native-windows: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

```

## Steps To Reproduce
I have create a demo that represent the problem [here on snack](https://snack.expo.io/@alentoma/banner)
To test this you will have to view it on your phone.

This is the code you should look into when you navigate  [snack](https://snack.expo.io/@alentoma/banner)
```
               <Text key={attr["index"]} style={{maxWidth:"100%",minWidth:"100%", backgroundColor:"red", justifyContent:"center"}} onPress={e=> {e.preventDefault() }}>
                      <Banner bannerSize="smartBannerPortrait"
                      />
                    </Text>
```

## Expected Results
The `Text` component should behave like `View` and when the screen Orientation is changed its children should also follow the `Text` component style

## Snack, code example, screenshot, or link to a repository:
https://snack.expo.io/@alentoma/banner
Repository: rust
Issue: Compilation error using a macro as a const generic argument (Rust 1.51 beta)
Labels: A-diagnostics,A-macros,T-lang,T-compiler,C-bug,A-const-generics,D-papercut

<!--
Thank you for filing a bug report! 🐛 Please provide a short summary of the bug,
along with any information you feel relevant to replicating the bug.
-->

(Playground link: https://play.rust-lang.org/?version=beta&mode=debug&edition=2018&gist=402577a37bb1cddc21d5bf4768594e65)

I tried this code:

```rust
macro_rules! expand_to_usize {
    () => {
        5usize
    }
}

fn print_const_generic_arg<const N: usize>() {
    println!("N = {}", N);
}

fn main() {
    // works
    print_const_generic_arg::<10>();
    
    // works
    const X: usize = expand_to_usize!();
    print_const_generic_arg::<X>();
    
    // doesn't work:
    print_const_generic_arg::<expand_to_usize!()>();
}
```

I expected to see this happen: Code compiles and prints

```
N = 10
N = 5
N = 5
```

Instead, this happened: The final call fails to compile with error messages that seem to be contradictory:

```
error: expected type, found `5usize`
  --> src/main.rs:3:9
   |
3  |         5usize
   |         ^^^^^^ expected type
...
20 |     print_const_generic_arg::<expand_to_usize!()>();
   |                               ------------------
   |                               |
   |                               this macro call doesn't expand to a type
   |                               in this macro invocation
   |
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0747]: type provided when a constant was expected
  --> src/main.rs:20:31
   |
20 |     print_const_generic_arg::<expand_to_usize!()>();
   |                               ^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors
```

### 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.
-->

Locally where I ran into this:

`rustc --version --verbose`:
```
rustc 1.51.0-beta.4 (4d25f4607 2021-03-05)
```

The playground says it's on 1.51.0-beta.6 and has the same error.
Repository: go
Issue: net: timeout in TestDNSSRVUniformity on linux-mips64le-rtrk
Labels: NeedsInvestigation

```
panic: test timed out after 12m0s

goroutine 105 [running]:
testing.(*M).startAlarm.func1()
	/tmp/gobuilder-mips64le/go/src/testing/testing.go:1743 +0x104
created by time.goFunc
	/tmp/gobuilder-mips64le/go/src/time/sleep.go:180 +0x5c

goroutine 1 [chan receive]:
testing.(*T).Run(0xc00019c180, 0x1202e111a, 0x14, 0x1202eedc0, 0x120116e01)
	/tmp/gobuilder-mips64le/go/src/testing/testing.go:1282 +0x2fc
testing.runTests.func1(0xc000082780)
	/tmp/gobuilder-mips64le/go/src/testing/testing.go:1554 +0x8c
testing.tRunner(0xc000082780, 0xc0000d9d90)
	/tmp/gobuilder-mips64le/go/src/testing/testing.go:1236 +0xf8
testing.runTests(0xc0000b8030, 0x120468680, 0xef, 0xef, 0xc00c1c584b6ffa75, 0xa7a3b36ca3, 0x120487100, 0x10)
	/tmp/gobuilder-mips64le/go/src/testing/testing.go:1552 +0x338
testing.(*M).Run(0xc0000de000, 0x0)
	/tmp/gobuilder-mips64le/go/src/testing/testing.go:1460 +0x1e0
net.TestMain(0xc0000de000)
	/tmp/gobuilder-mips64le/go/src/net/main_test.go:53 +0x4c
main.main()
	_testmain.go:593 +0x198

goroutine 117 [runnable]:
net.byPriorityWeight.shuffleByWeight(0xc0001d4000, 0x3, 0x3)
	/tmp/gobuilder-mips64le/go/src/net/dnsclient.go:172 +0x1c
net.checkDistribution(0xc00019c180, 0xc00019e090, 0x3, 0x3, 0x3fb999999999999a)
	/tmp/gobuilder-mips64le/go/src/net/dnsclient_test.go:23 +0x1ac
net.testUniformity(0xc00019c180, 0x3, 0x3fb999999999999a)
	/tmp/gobuilder-mips64le/go/src/net/dnsclient_test.go:45 +0x170
net.TestDNSSRVUniformity(0xc00019c180)
	/tmp/gobuilder-mips64le/go/src/net/dnsclient_test.go:50 +0x7c
testing.tRunner(0xc00019c180, 0x1202eedc0)
	/tmp/gobuilder-mips64le/go/src/testing/testing.go:1236 +0xf8
created by testing.(*T).Run
	/tmp/gobuilder-mips64le/go/src/testing/testing.go:1281 +0x2dc
FAIL	net	720.061s
```

[2021-03-15T21:49:19-de2b27d/linux-mips64le-rtrk](https://build.golang.org/log/7b13f53a74ffa96d8769cd766b11e9d2474a848d)

Not clear to me whether this is a defect in the test itself, the code under test, or the platform / builder.

CC @bogojevic @milanknezevic
Repository: vscode
Issue: Type ahead should turn off temporarily when it fails on a line
Labels: bug,terminal-local-echo

It fails so why does it keep trying? Also it's trying to fill in when typing on the left edge of the terminal which I thought should not happen?

![recording](https://user-images.githubusercontent.com/2193314/111346076-1a750080-863b-11eb-95cf-e923e9aa2bcb.gif)
Repository: pytorch
Issue: [FX] Add guards in files in `test/fx` to make sure they're not run directly
Labels: triaged,module: fx

Similarly to how JIT tests do it: https://github.com/pytorch/pytorch/blob/bea3cb70693ee85d3f7435efa7232c7fd2fe50cd/test/jit/test_logging.py#L11

cc @ezyang
Repository: pytorch
Issue: [cuda extension] tutorial should mention device guard
Labels: module: cpp-extensions,module: docs,triaged

The defacto only reliable reference (https://pytorch.org/tutorials/advanced/cpp_extension.html) for C++ and CUDA extension is not using device guards, which makes the resulting extension broken for non default device. 

cc @yf225 @glaringlee @brianjo @mruberry