Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inner attribute syntax from #[foo]; to #![foo] #13311

Closed
wants to merge 1 commit into from
Closed

Fix inner attribute syntax from #[foo]; to #![foo] #13311

wants to merge 1 commit into from

Conversation

Siosm
Copy link
Contributor

@Siosm Siosm commented Apr 4, 2014

From the 0.10 changelog:

  • The inner attribute syntax has changed from #[foo]; to #![foo].

I've run the tests, but I've got results I do not understand:
https://tim.siosm.fr/downloads/rust_tests_master.log (run on f819c21)
https://tim.siosm.fr/downloads/rust_tests_patched.log (run on f819c21 + patch; I've made a rebase since but did not rerun the checks)

From the 0.10 changelog:
 * The inner attribute syntax has changed from `#[foo];` to `#![foo]`.
@Siosm
Copy link
Contributor Author

Siosm commented Apr 4, 2014

There is something odd here: Travis CI says it's OK, while 'make check' on my system returns with errors: https://tim.siosm.fr/downloads/rust_tests_patched_rebased.log

@lilyball
Copy link
Contributor

lilyball commented Apr 4, 2014

@Siosm

io error when running tests: resource temporarily unavailable (Resource temporarily unavailable)

Maybe you hit some sort of resource exhaustion on your system?

@Siosm
Copy link
Contributor Author

Siosm commented Apr 4, 2014

@kballard: Well, this is unlikely, as I've got 16GB RAM and 500GB free disk space on this system. Especially since Travis CI instances are supposed limited to be 3GB RAM. I'll have a look at the system status while running the tests next time.

@lilyball
Copy link
Contributor

lilyball commented Apr 4, 2014

@Siosm There are more resources than just RAM. Maybe you hit some other limit (e.g. fd limit)?

@Siosm
Copy link
Contributor Author

Siosm commented Apr 4, 2014

@kballard: I've got standard Linux limits:
$ ulimit -a
-t: cpu time (seconds) unlimited
-f: file size (blocks) unlimited
-d: data seg size (kbytes) unlimited
-s: stack size (kbytes) 8192
-c: core file size (blocks) 0
-m: resident set size (kbytes) unlimited
-u: processes 126488
-n: file descriptors 1024
-l: locked-in-memory size (kbytes) 64
-v: address space (kbytes) unlimited
-x: file locks unlimited
-i: pending signals 126488
-q: bytes in POSIX msg queues 819200
-e: max nice 20
-r: max rt priority 0
-N 15: unlimited

Should I raise any one of those in particular? I found nothing in the doc so far (https://github.com/mozilla/rust/wiki/Note-testsuite). I'm trying:
make check RUST_TEST_TASKS=1

@lilyball
Copy link
Contributor

lilyball commented Apr 4, 2014

@Siosm I have no idea. It was just a guess, but upon re-reading your error, the message is "Resource temporarily unavailable" which I believe actually comes from EAGAIN, rather than hitting a resource limit. So the question is, what is Rust doing here that triggers an EAGAIN that it isn't handling?

@thestinger
Copy link
Contributor

@kballard: I think it's a libuv bug because the test harness still uses libgreen. I run into it all the time too, so I can't run the tests anymore. From watching it in strace, it certainly gets a lot of EINVAL returns for the stuff it does to files with ioctl, etc.

@alexcrichton
Copy link
Member

I think it's a libuv bug because the test harness still uses libgreen

This is not true.

I run into it all the time too, so I can't run the tests anymore

It would be nice to report this then.

@Siosm
Copy link
Contributor Author

Siosm commented Apr 4, 2014

rust/src/libstd/comm/mod.rs:437 > The doc says the function try_send is trying hard not to fail, but it may yield and the send function is using it.

@thestinger
Copy link
Contributor

@alexcrichton: So running stdtest doesn't use libgreen?

@lilyball
Copy link
Contributor

lilyball commented Apr 4, 2014

@Siosm I don't see that. The documentation of try_send() says nothing about it failing under any circumstance other than the other end having hung up already. And the comment inside of try_send() pretty much only says that sometimes it will yield before sending.

@alexcrichton
Copy link
Member

stdtest does use libgreen, you said "test harness", which is not true. The error was seen during nativetest.

@Siosm
Copy link
Contributor Author

Siosm commented Apr 4, 2014

@kballard: My bad, I misread. I don't know what's the issue. Maybe it's related to the test.

@lilyball
Copy link
Contributor

lilyball commented Apr 4, 2014

Based on the fact that it failed without having written what test it was trying to run, I believe it failed when trying to write "test {name_of_test} ...". Since I assume you're at a terminal, it means the call term.write() failed.

@Siosm
Copy link
Contributor Author

Siosm commented Apr 4, 2014

I've got the results of 'make check RUST_TEST_TASKS=1':
https://tim.siosm.fr/downloads/rust_tests_patched_nomultithread.log

I forgot to update the pretty-printed source test. I'm having a look.

@lilyball
Copy link
Contributor

lilyball commented Apr 4, 2014

After poking around for a while, I have to assume the error came from libnative::io::FileDesc.inner_write() when writing to the terminal. What I don't understand is why it would return EAGAIN. The WRITE(2) manpage says EAGAIN means the file descriptor is not a socket and has been marked O_NONBLOCK and the write would block. This confuses me because Rust doesn't use non-blocking I/O, so I don't know why stdout would be marked as O_NONBLOCK.

In any case, I have to assume that make check wrote output faster than your terminal could process it (what Terminal are you using?) and the buffer filled up.

You could try redirecting the output to a file.

@lilyball
Copy link
Contributor

lilyball commented Apr 4, 2014

@alexcrichton Any idea if my analysis is correct, and any answer as to why stdout would be marked O_NONBLOCK?

@alexcrichton
Copy link
Member

That was exactly the conclusion I reached, and I have no idea why it would be set to non-blocking.

@Siosm
Copy link
Contributor Author

Siosm commented Apr 4, 2014

I'm using Yakuake (Konsole). I'll try redirecting the output to a file.

@lilyball
Copy link
Contributor

lilyball commented Apr 4, 2014

@alexcrichton I found a thread that indicates that non-blockingness of fds is actually a property of the underlying descriptor, and not of the per-process fd object. So a pseudo-TTY that is set to non-blocking from another process will become non-blocking in any process that uses the same device.

So basically, whenever we're talking to TTYs they might be non-blocking.

I have no idea what to do about this. I don't suppose there's a POSIX call that issues a write() (or a read()) in blocking mode even for non-blocking fds?

@alexcrichton
Copy link
Member

Without a reliable method of reproduction, I'm wary to implement any fixes, but I would suspect that "just try 10 times in a row" would be sufficient for almost all use cases.

@lilyball
Copy link
Contributor

lilyball commented Apr 4, 2014

@alexcrichton You could try creating a sample program that sets its stdin to O_NONBLOCK, then never reads, and write a Rust program that writes, say, 1MB to stdout (using libnative). Pipe them together and see what happens.

@lilyball
Copy link
Contributor

lilyball commented Apr 4, 2014

Although now that I think about it, I would expect unix pipes to actually use separate underlying descriptor objects for each end. It's probably a PTTY-specific issue.

@Siosm
Copy link
Contributor Author

Siosm commented Apr 4, 2014

May I suggest using a select (or select-like) call to wait on this specific issue?

@bors bors closed this in 4cf8d8c Apr 5, 2014
@lilyball
Copy link
Contributor

lilyball commented Apr 5, 2014

@alexcrichton I've come up with a 100% reliable reproduction method, where Rust never sets O_NONBLOCK and yet its stdout has O_NONBLOCK set. I'll write up a separate issue.

@lilyball
Copy link
Contributor

lilyball commented Apr 5, 2014

I've filed the issue as #13336.

matthiaskrgr pushed a commit to matthiaskrgr/rust that referenced this pull request Oct 11, 2022
…Veykril

fix: infer for-loop item type with `IntoIterator` and `Iterator`

Part of rust-lang#13299

We've been inferring the type of the yielded values in for-loop as `<T as IntoIterator>::Item`. We infer the correct type most of the time when we normalize the projection type, but it turns out not always. We should infer the type as `<<T as IntoIterator>::IntoIter as Iterator>::Item`.

When one specifies `IntoIter` assoc type of `IntoIterator` but not `Item` in generic bounds, we fail to normalize `<T as IntoIterator>::Item` (even though `IntoIter` is defined like so: `type IntoIter: Iterator<Item = Self::Item>` - rustc does *not* normalize projections based on other projection's bound I believe; see [this playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=e88e19385094cb98fadbf647b4c2082e)).

Note that this doesn't fully fix # 13299 - given the following code, chalk can normalize `<I as IntoIterator>::IntoIter` to `S`, but cannot normalize `<S as Iterator>::Item` to `i32`.

```rust
struct S;
impl Iterator for S { type Item = i32; /* ... */ }
fn f<I: IntoIterator<IntoIter = S>>(it: I) {
    for elem in it {}
      //^^^^{unknown}
}
```

This is because chalk finds multiple answers that satisfy the query `AliasEq(<S as Iterator>::Item = ?X`: `?X = i32` and `?X = <I as IntoIterator>::Item` - which are supposed to be the same type due to the aforementioned bound on `IntoIter` but chalk is unable to figure it out.
flip1995 pushed a commit to flip1995/rust that referenced this pull request Sep 5, 2024
…ns, r=Manishearth

Fix manual_range_patterns case with one element at OR

Close rust-lang#11825
As mentioned rust-lang#11825 `OR` can be used for stylistic purposes with one element, we can filter this case from triggering lint

changelog: [`manual_range_patterns`]: not trigger when `OR` has only one element
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants