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

Removed prelude::* from libstd files. #12006

Closed
wants to merge 10 commits into from
Closed

Removed prelude::* from libstd files. #12006

wants to merge 10 commits into from

Conversation

chromatic
Copy link
Contributor

This replaces the imports from the prelude with the re-exported symbols, as requested in #11983.

@chromatic
Copy link
Contributor Author

I'm not sure how to fix that exception (looks like that warning may have been there for a while), but I think this patch will fix the Windows build.

#[cfg(target_os = "macos")]
#[cfg(target_os = "windows")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably needs to be #[cfg(windows)]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or target_os="win32", iirc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe. The only use of range() is in a function with #[cfg(windows)]. I don't know if one is the superset of the other.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chromatic
Copy link
Contributor Author

One more try to get the Windows guard working.

nrc and others added 10 commits February 5, 2014 17:57
This cleans up a warning about an unused variable and explains the code
further.
A solid step towards fixing #11998. Eventually, the size may always be
passed to `exchange_free` but this will not be required to fix the bug.
- `extra::json` didn't make the cut, because of `extra::json` required
   dep on `extra::TreeMap`. If/when `extra::TreeMap` moves out of `extra`,
   then `extra::json` could move into `serialize`
- `libextra`, `libsyntax` and `librustc` depend on the newly created
  `libserialize`
- The extensions to various `extra` types like `DList`, `RingBuf`, `TreeMap`
  and `TreeSet` for `Encodable`/`Decodable` were moved into the respective
  modules in `extra`
- There is some trickery, evident in `src/libextra/lib.rs` where a stub
  of `extra::serialize` is set up (in `src/libextra/serialize.rs`) for
  use in the stage0 build, where the snapshot rustc is still making
  deriving for `Encodable` and `Decodable` point at extra. Big props to
  @huonw for help working out the re-export solution for this

extra: inline extra::serialize stub

fix stuff clobbered in rebase + don't reexport serialize::serialize

no more globs in libserialize

syntax: fix import of libserialize traits

librustc: fix bad imports in encoder/decoder

add serialize dep to librustdoc

fix failing run-pass tests w/ serialize dep

adjust uuid dep

more rebase de-clobbering for libserialize

fixing tests, pushing libextra dep into cfg(test)

fix doc code in extra::json

adjust index.md links to serialize and uuid library
This is part of the overall strategy I would like to take when approaching
issue #11165. The only two I/O objects that reasonably want to be "split" are
the network stream objects. Everything else can be "split" by just creating
another version.

The initial idea I had was the literally split the object into a reader and a
writer half, but that would just introduce lots of clutter with extra interfaces
that were a little unnnecssary, or it would return a ~Reader and a ~Writer which
means you couldn't access things like the remote peer name or local socket name.

The solution I found to be nicer was to just clone the stream itself. The clone
is just a clone of the handle, nothing fancy going on at the kernel level.
Conceptually I found this very easy to wrap my head around (everything else
supports clone()), and it solved the "split" problem at the same time.

The cloning support is pretty specific per platform/lib combination:

* native/win32 - uses some specific WSA apis to clone the SOCKET handle
* native/unix - uses dup() to get another file descriptor
* green/all - This is where things get interesting. When we support full clones
              of a handle, this implies that we're allowing simultaneous writes
              and reads to happen. It turns out that libuv doesn't support two
              simultaneous reads or writes of the same object. It does support
              *one* read and *one* write at the same time, however. Some extra
              infrastructure was added to just block concurrent writers/readers
              until the previous read/write operation was completed.

I've added tests to the tcp/unix modules to make sure that this functionality is
supported everywhere.
This replaces the imports from the prelude with the re-exported symbols.
@alexcrichton
Copy link
Member

I pushed this to try, and it works on everything but windows: http://buildbot.rust-lang.org/builders/try-win/builds/875

This also looks like it's picked up a few extra commits during the rebasings

@chromatic
Copy link
Contributor Author

Unless there are any objections, I'll create a new branch and a new PR for this, probably early tomorrow. It should be easy enough to cherry-pick the two useful commits.

@chromatic chromatic mentioned this pull request Feb 6, 2014
@chromatic chromatic closed this Feb 6, 2014
@chromatic chromatic deleted the gh_11983_deglob_std branch February 6, 2014 21:42
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 25, 2022
fix: Remove `rust-analyzer.inlayHints.enable` and set language scope

Closes rust-lang#12036
CC rust-lang/rust-analyzer#12027 (comment)

The key was left there by mistake in rust-lang#12006.

Setting the configuration scope only works if you already have it created, which is fine, but unfortunately not quite discoverable.
flip1995 pushed a commit to flip1995/rust that referenced this pull request Feb 8, 2024
…ero, r=llogiq

Don't warn about modulo arithmetic when comparing to zero

closes rust-lang#12006

By default, don't warn about modulo arithmetic when comparing to zero. This behavior is configurable via `clippy.toml`.

See discussion [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/.E2.9C.94.20Is.20issue.20.2312006.20worth.20implementing.3F)

changelog: [`modulo_arithmetic`]: By default don't lint when comparing the result of a modulo operation to zero.
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.

9 participants