Get rid of the unnecessary parenthesies that crept into some macros.
Remove a FIXME that was already fixed.
Fix a comment that wasn't rendering correctly in rustdoc.
(Expressed another way: make `[[` et al. work with the curly brace at
the end of a line as is standard Rust style, not just at the start is it
is by default in Vim, from K&R style.)
This came out of #11492, where a simpler but less effective technique
was initially proposed; some discussion of the techniques, ways and
means can be found there.
There are still a few caveats:
- Operator-pending mode behaves differently to the standard behaviour:
if inside curly braces, it should delete up to and including the
closing of the outermost curly brace (that doesn't seem to me
consistent with documented behaviour, but it's what it does). Actual
behaviour (the more logical and consistent, in my opinion): up to the
start of the next outermost curly brace.
- With folding enabled (`set fdm=syntax`), `[[` and `]]` do not behave
as they should: the default behaviour treats an entire closed fold as
one line for these purposes while this code does not (I explicitly
`set nofoldenable` in the function—the side-effects are worse with
folds enabled), leading to unexpected behaviour, the worst of which is
`[[` and/or `]]` not working in visual mode on a closed fold (visual
mode keeps it at the extreme end of the region line of the folded
region, so it's always going back to the opening line of that fold and
immediately being shoved back to the end by visual mode).
- `[[` and `]]` are operating inside comments, whereas the standard
behaviour skips comments.
- The viewport position is sometimes changed when it should not be
necessary.
Just like the bare keyword `crate` is highlighted as Error (a little
dubious, actually, given macros), `mod` is invalid after `extern`: it's
obsolete syntax.
The most significant fix is for `syntax::ext::deriving::encodable`,
where one of the blocks of code, auspiciously containing `<S>` (recall
that Markdown allows arbitrary HTML to be contained inside it), was not
formatted as a code block, with a fun but messy effect.
The rustdoc tests create and execute a file in a temporary directory. By
default on UNIX-like platforms this is in `/tmp`, which some users mount
with the `noexec` option. In those cases, the tests fail in a mysterious
way. This change adds a note that suggests what the problem might be, if
the error looks like it could have been caused by the `noexec` setup.
Closes#12558
With linkers on unix systems, libraries on the right of the command line are
used to resolve symbols in those on the left of the command line. This means
that arguments must have a right-to-left dependency chain (things on the left
depend on things on the right).
This is currently done by ordering the linker arguments as
1. Local object
2. Local native libraries
3. Upstream rust libraries
4. Upstream native libraries
This commit swaps the order of 2 and 3 so upstream rust libraries have access to
local native libraries. It has been seen that some upstream crates don't specify
the library that they link to because the name varies per platform (e.g.
lua/glfw/etc).
This commit enables building these libraries by allowing the upstream rust crate
to have access to local native libraries. I believe that the failure mode for
this scheme is when an upstream rust crate depends on a symbol in an upstream
library which is then redefined in a local library. This failure mode is
incredibly uncommon, and the failure mode also varies per platform (OSX behaves
differently), so I believe that a change like this is fine to make.
Closes#12446
This pull request partially addresses the 2 issues listed before. As part of the work required for this PR, `NonCopyable` was completely removed.
This PR also replaces the content of `type_is_pod` with `TypeContents::is_pod`, although `type_is_content` is currently not being used anywhere. I kept it for consistency with the other functions that exist in this module.
cc #10834
cc #10577
Proposed static restrictions
=====================
Taken from [this](https://github.com/mozilla/rust/pull/11979#issuecomment-35768249) comment.
I expect some code that, at a high-level, works like this:
- For each *mutable* static item, check that the **type**:
- cannot own any value whose type has a dtor
- cannot own any values whose type is an owned pointer
- For each *immutable* static item, check that the **value**:
- does not contain any ~ or box expressions (including ~[1, 2, 3] sort of things, for now)
- does not contain a struct literal or call to an enum variant / struct constructor where
- the type of the struct/enum is freeze
- the type of the struct/enum has a dtor
These commits fix handling of binary files on windows by using the raw `CreateFile` apis directly, also splitting out the windows/unix implementations to their own files because everything was configured between the two platforms.
With this fix in place, this also switches `rustc` to using libnative instead of libgreen. I have confirmed that this PR passes through try on all bots.
The compiler itself doesn't necessarily need any features of green threading
such as spawning tasks and lots of I/O, so libnative is slightly more
appropriate for rustc to use itself.
This should also help the rusti bot which is currently incompatible with libuv.
This commit splits the file implementation into file_unix and file_win32. The
two implementations have diverged to the point that they share almost 0 code at
this point, so it's easier to maintain as separate files.
The other major change accompanied with this commit is that file::open is no
longer based on libc's open function on windows, but rather windows's CreateFile
function. This fixes dealing with binary files on windows (test added in
previous commit).
This also changes the read/write functions to use ReadFile and WriteFile instead
of libc's read/write.
Closes#12406
This weeds out a bunch of warnings building stdtest on windows, and it also adds
a check! macro to the io::fs tests to help diagnose errors that are cropping up
on windows platforms as well.
cc #12516
- For each *mutable* static item, check that the **type**:
- cannot own any value whose type has a dtor
- cannot own any values whose type is an owned pointer
- For each *immutable* static item, check that the **value**:
- does not contain any ~ or box expressions
(including ~[1, 2, 3] sort of things)
- does not contain a struct literal or call to an enum
variant / struct constructor where
- the type of the struct/enum has a dtor
I've added details in the description of each comment as to what it does, which I won't redundantly repeat here in the PR. They all relate to indentation in the emacs rust-mode.
What I will note here is that this closes#8787. It addresses the last remaining case (not in the original issue description but in a comment), of indenting `match` statements. With the changes here, I believe every problem described in the issue description or comments of #8787 is addressed.
The pretty printer was treating block comments with more than two
asterisks after the first slash (e.g. `/***`) as doc comments (which are
attributes), whereas in actual fact they are just regular comments.
The pretty printer was treating block comments with more than two
asterisks after the first slash (e.g. `/***`) as doc comments (which are
attributes), whereas in actual fact they are just regular comments.