Skip to content

Commit 9c1567e

Browse files
committed
Fallout from glob shadowing
1 parent f53314c commit 9c1567e

File tree

5 files changed

+50
-67
lines changed

5 files changed

+50
-67
lines changed

src/librustc_trans/trans/base.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,8 +1554,7 @@ pub fn arg_kind<'a, 'tcx>(cx: &FunctionContext<'a, 'tcx>, t: Ty<'tcx>)
15541554
}
15551555

15561556
// work around bizarre resolve errors
1557-
pub type RvalueDatum<'tcx> = datum::Datum<'tcx, datum::Rvalue>;
1558-
pub type LvalueDatum<'tcx> = datum::Datum<'tcx, datum::Lvalue>;
1557+
type RvalueDatum<'tcx> = datum::Datum<'tcx, datum::Rvalue>;
15591558

15601559
// create_datums_for_fn_args: creates rvalue datums for each of the
15611560
// incoming function arguments. These will later be stored into

src/librustc_trans/trans/common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ pub fn validate_substs(substs: &Substs) {
190190
}
191191

192192
// work around bizarre resolve errors
193-
pub type RvalueDatum<'tcx> = datum::Datum<'tcx, datum::Rvalue>;
194-
pub type LvalueDatum<'tcx> = datum::Datum<'tcx, datum::Lvalue>;
193+
type RvalueDatum<'tcx> = datum::Datum<'tcx, datum::Rvalue>;
194+
type LvalueDatum<'tcx> = datum::Datum<'tcx, datum::Lvalue>;
195195

196196
// Function context. Every LLVM function we create will have one of
197197
// these.

src/libstd/comm/mod.rs

Lines changed: 46 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@
181181
// senders. Under the hood, however, there are actually three flavors of
182182
// channels in play.
183183
//
184-
// * Oneshots - these channels are highly optimized for the one-send use case.
184+
// * Flavor::Oneshots - these channels are highly optimized for the one-send use case.
185185
// They contain as few atomics as possible and involve one and
186186
// exactly one allocation.
187187
// * Streams - these channels are optimized for the non-shared use case. They
@@ -316,7 +316,6 @@ use core::prelude::*;
316316

317317
pub use self::TryRecvError::*;
318318
pub use self::TrySendError::*;
319-
use self::Flavor::*;
320319

321320
use alloc::arc::Arc;
322321
use core::kinds;
@@ -478,7 +477,7 @@ impl<T> UnsafeFlavor<T> for Receiver<T> {
478477
#[unstable]
479478
pub fn channel<T: Send>() -> (Sender<T>, Receiver<T>) {
480479
let a = Arc::new(RacyCell::new(oneshot::Packet::new()));
481-
(Sender::new(Oneshot(a.clone())), Receiver::new(Oneshot(a)))
480+
(Sender::new(Flavor::Oneshot(a.clone())), Receiver::new(Flavor::Oneshot(a)))
482481
}
483482

484483
/// Creates a new synchronous, bounded channel.
@@ -518,7 +517,7 @@ pub fn channel<T: Send>() -> (Sender<T>, Receiver<T>) {
518517
of channel that is is creating"]
519518
pub fn sync_channel<T: Send>(bound: uint) -> (SyncSender<T>, Receiver<T>) {
520519
let a = Arc::new(RacyCell::new(sync::Packet::new(bound)));
521-
(SyncSender::new(a.clone()), Receiver::new(Sync(a)))
520+
(SyncSender::new(a.clone()), Receiver::new(Flavor::Sync(a)))
522521
}
523522

524523
////////////////////////////////////////////////////////////////////////////////
@@ -592,15 +591,15 @@ impl<T: Send> Sender<T> {
592591
#[unstable = "this function may be renamed to send() in the future"]
593592
pub fn send_opt(&self, t: T) -> Result<(), T> {
594593
let (new_inner, ret) = match *unsafe { self.inner() } {
595-
Oneshot(ref p) => {
594+
Flavor::Oneshot(ref p) => {
596595
unsafe {
597596
let p = p.get();
598597
if !(*p).sent() {
599598
return (*p).send(t);
600599
} else {
601600
let a =
602601
Arc::new(RacyCell::new(stream::Packet::new()));
603-
match (*p).upgrade(Receiver::new(Stream(a.clone()))) {
602+
match (*p).upgrade(Receiver::new(Flavor::Stream(a.clone()))) {
604603
oneshot::UpSuccess => {
605604
let ret = (*a.get()).send(t);
606605
(a, ret)
@@ -618,13 +617,13 @@ impl<T: Send> Sender<T> {
618617
}
619618
}
620619
}
621-
Stream(ref p) => return unsafe { (*p.get()).send(t) },
622-
Shared(ref p) => return unsafe { (*p.get()).send(t) },
623-
Sync(..) => unreachable!(),
620+
Flavor::Stream(ref p) => return unsafe { (*p.get()).send(t) },
621+
Flavor::Shared(ref p) => return unsafe { (*p.get()).send(t) },
622+
Flavor::Sync(..) => unreachable!(),
624623
};
625624

626625
unsafe {
627-
let tmp = Sender::new(Stream(new_inner));
626+
let tmp = Sender::new(Flavor::Stream(new_inner));
628627
mem::swap(self.inner_mut(), tmp.inner_mut());
629628
}
630629
return ret;
@@ -635,53 +634,53 @@ impl<T: Send> Sender<T> {
635634
impl<T: Send> Clone for Sender<T> {
636635
fn clone(&self) -> Sender<T> {
637636
let (packet, sleeper, guard) = match *unsafe { self.inner() } {
638-
Oneshot(ref p) => {
637+
Flavor::Oneshot(ref p) => {
639638
let a = Arc::new(RacyCell::new(shared::Packet::new()));
640639
unsafe {
641640
let guard = (*a.get()).postinit_lock();
642-
match (*p.get()).upgrade(Receiver::new(Shared(a.clone()))) {
641+
match (*p.get()).upgrade(Receiver::new(Flavor::Shared(a.clone()))) {
643642
oneshot::UpSuccess |
644643
oneshot::UpDisconnected => (a, None, guard),
645644
oneshot::UpWoke(task) => (a, Some(task), guard)
646645
}
647646
}
648647
}
649-
Stream(ref p) => {
648+
Flavor::Stream(ref p) => {
650649
let a = Arc::new(RacyCell::new(shared::Packet::new()));
651650
unsafe {
652651
let guard = (*a.get()).postinit_lock();
653-
match (*p.get()).upgrade(Receiver::new(Shared(a.clone()))) {
652+
match (*p.get()).upgrade(Receiver::new(Flavor::Shared(a.clone()))) {
654653
stream::UpSuccess |
655654
stream::UpDisconnected => (a, None, guard),
656655
stream::UpWoke(task) => (a, Some(task), guard),
657656
}
658657
}
659658
}
660-
Shared(ref p) => {
659+
Flavor::Shared(ref p) => {
661660
unsafe { (*p.get()).clone_chan(); }
662-
return Sender::new(Shared(p.clone()));
661+
return Sender::new(Flavor::Shared(p.clone()));
663662
}
664-
Sync(..) => unreachable!(),
663+
Flavor::Sync(..) => unreachable!(),
665664
};
666665

667666
unsafe {
668667
(*packet.get()).inherit_blocker(sleeper, guard);
669668

670-
let tmp = Sender::new(Shared(packet.clone()));
669+
let tmp = Sender::new(Flavor::Shared(packet.clone()));
671670
mem::swap(self.inner_mut(), tmp.inner_mut());
672671
}
673-
Sender::new(Shared(packet))
672+
Sender::new(Flavor::Shared(packet))
674673
}
675674
}
676675

677676
#[unsafe_destructor]
678677
impl<T: Send> Drop for Sender<T> {
679678
fn drop(&mut self) {
680679
match *unsafe { self.inner_mut() } {
681-
Oneshot(ref mut p) => unsafe { (*p.get()).drop_chan(); },
682-
Stream(ref mut p) => unsafe { (*p.get()).drop_chan(); },
683-
Shared(ref mut p) => unsafe { (*p.get()).drop_chan(); },
684-
Sync(..) => unreachable!(),
680+
Flavor::Oneshot(ref mut p) => unsafe { (*p.get()).drop_chan(); },
681+
Flavor::Stream(ref mut p) => unsafe { (*p.get()).drop_chan(); },
682+
Flavor::Shared(ref mut p) => unsafe { (*p.get()).drop_chan(); },
683+
Flavor::Sync(..) => unreachable!(),
685684
}
686685
}
687686
}
@@ -827,30 +826,30 @@ impl<T: Send> Receiver<T> {
827826
pub fn try_recv(&self) -> Result<T, TryRecvError> {
828827
loop {
829828
let new_port = match *unsafe { self.inner() } {
830-
Oneshot(ref p) => {
829+
Flavor::Oneshot(ref p) => {
831830
match unsafe { (*p.get()).try_recv() } {
832831
Ok(t) => return Ok(t),
833832
Err(oneshot::Empty) => return Err(Empty),
834833
Err(oneshot::Disconnected) => return Err(Disconnected),
835834
Err(oneshot::Upgraded(rx)) => rx,
836835
}
837836
}
838-
Stream(ref p) => {
837+
Flavor::Stream(ref p) => {
839838
match unsafe { (*p.get()).try_recv() } {
840839
Ok(t) => return Ok(t),
841840
Err(stream::Empty) => return Err(Empty),
842841
Err(stream::Disconnected) => return Err(Disconnected),
843842
Err(stream::Upgraded(rx)) => rx,
844843
}
845844
}
846-
Shared(ref p) => {
845+
Flavor::Shared(ref p) => {
847846
match unsafe { (*p.get()).try_recv() } {
848847
Ok(t) => return Ok(t),
849848
Err(shared::Empty) => return Err(Empty),
850849
Err(shared::Disconnected) => return Err(Disconnected),
851850
}
852851
}
853-
Sync(ref p) => {
852+
Flavor::Sync(ref p) => {
854853
match unsafe { (*p.get()).try_recv() } {
855854
Ok(t) => return Ok(t),
856855
Err(sync::Empty) => return Err(Empty),
@@ -881,30 +880,30 @@ impl<T: Send> Receiver<T> {
881880
pub fn recv_opt(&self) -> Result<T, ()> {
882881
loop {
883882
let new_port = match *unsafe { self.inner() } {
884-
Oneshot(ref p) => {
883+
Flavor::Oneshot(ref p) => {
885884
match unsafe { (*p.get()).recv() } {
886885
Ok(t) => return Ok(t),
887886
Err(oneshot::Empty) => return unreachable!(),
888887
Err(oneshot::Disconnected) => return Err(()),
889888
Err(oneshot::Upgraded(rx)) => rx,
890889
}
891890
}
892-
Stream(ref p) => {
891+
Flavor::Stream(ref p) => {
893892
match unsafe { (*p.get()).recv() } {
894893
Ok(t) => return Ok(t),
895894
Err(stream::Empty) => return unreachable!(),
896895
Err(stream::Disconnected) => return Err(()),
897896
Err(stream::Upgraded(rx)) => rx,
898897
}
899898
}
900-
Shared(ref p) => {
899+
Flavor::Shared(ref p) => {
901900
match unsafe { (*p.get()).recv() } {
902901
Ok(t) => return Ok(t),
903902
Err(shared::Empty) => return unreachable!(),
904903
Err(shared::Disconnected) => return Err(()),
905904
}
906905
}
907-
Sync(ref p) => return unsafe { (*p.get()).recv() }
906+
Flavor::Sync(ref p) => return unsafe { (*p.get()).recv() }
908907
};
909908
unsafe {
910909
mem::swap(self.inner_mut(), new_port.inner_mut());
@@ -924,22 +923,22 @@ impl<T: Send> select::Packet for Receiver<T> {
924923
fn can_recv(&self) -> bool {
925924
loop {
926925
let new_port = match *unsafe { self.inner() } {
927-
Oneshot(ref p) => {
926+
Flavor::Oneshot(ref p) => {
928927
match unsafe { (*p.get()).can_recv() } {
929928
Ok(ret) => return ret,
930929
Err(upgrade) => upgrade,
931930
}
932931
}
933-
Stream(ref p) => {
932+
Flavor::Stream(ref p) => {
934933
match unsafe { (*p.get()).can_recv() } {
935934
Ok(ret) => return ret,
936935
Err(upgrade) => upgrade,
937936
}
938937
}
939-
Shared(ref p) => {
938+
Flavor::Shared(ref p) => {
940939
return unsafe { (*p.get()).can_recv() };
941940
}
942-
Sync(ref p) => {
941+
Flavor::Sync(ref p) => {
943942
return unsafe { (*p.get()).can_recv() };
944943
}
945944
};
@@ -953,24 +952,24 @@ impl<T: Send> select::Packet for Receiver<T> {
953952
fn start_selection(&self, mut token: SignalToken) -> StartResult {
954953
loop {
955954
let (t, new_port) = match *unsafe { self.inner() } {
956-
Oneshot(ref p) => {
955+
Flavor::Oneshot(ref p) => {
957956
match unsafe { (*p.get()).start_selection(token) } {
958957
oneshot::SelSuccess => return Installed,
959958
oneshot::SelCanceled => return Abort,
960959
oneshot::SelUpgraded(t, rx) => (t, rx),
961960
}
962961
}
963-
Stream(ref p) => {
962+
Flavor::Stream(ref p) => {
964963
match unsafe { (*p.get()).start_selection(token) } {
965964
stream::SelSuccess => return Installed,
966965
stream::SelCanceled => return Abort,
967966
stream::SelUpgraded(t, rx) => (t, rx),
968967
}
969968
}
970-
Shared(ref p) => {
969+
Flavor::Shared(ref p) => {
971970
return unsafe { (*p.get()).start_selection(token) };
972971
}
973-
Sync(ref p) => {
972+
Flavor::Sync(ref p) => {
974973
return unsafe { (*p.get()).start_selection(token) };
975974
}
976975
};
@@ -985,14 +984,14 @@ impl<T: Send> select::Packet for Receiver<T> {
985984
let mut was_upgrade = false;
986985
loop {
987986
let result = match *unsafe { self.inner() } {
988-
Oneshot(ref p) => unsafe { (*p.get()).abort_selection() },
989-
Stream(ref p) => unsafe {
987+
Flavor::Oneshot(ref p) => unsafe { (*p.get()).abort_selection() },
988+
Flavor::Stream(ref p) => unsafe {
990989
(*p.get()).abort_selection(was_upgrade)
991990
},
992-
Shared(ref p) => return unsafe {
991+
Flavor::Shared(ref p) => return unsafe {
993992
(*p.get()).abort_selection(was_upgrade)
994993
},
995-
Sync(ref p) => return unsafe {
994+
Flavor::Sync(ref p) => return unsafe {
996995
(*p.get()).abort_selection()
997996
},
998997
};
@@ -1015,10 +1014,10 @@ impl<'a, T: Send> Iterator<T> for Messages<'a, T> {
10151014
impl<T: Send> Drop for Receiver<T> {
10161015
fn drop(&mut self) {
10171016
match *unsafe { self.inner_mut() } {
1018-
Oneshot(ref mut p) => unsafe { (*p.get()).drop_port(); },
1019-
Stream(ref mut p) => unsafe { (*p.get()).drop_port(); },
1020-
Shared(ref mut p) => unsafe { (*p.get()).drop_port(); },
1021-
Sync(ref mut p) => unsafe { (*p.get()).drop_port(); },
1017+
Flavor::Oneshot(ref mut p) => unsafe { (*p.get()).drop_port(); },
1018+
Flavor::Stream(ref mut p) => unsafe { (*p.get()).drop_port(); },
1019+
Flavor::Shared(ref mut p) => unsafe { (*p.get()).drop_port(); },
1020+
Flavor::Sync(ref mut p) => unsafe { (*p.get()).drop_port(); },
10221021
}
10231022
}
10241023
}

src/test/run-pass/issue-7663.rs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ mod test1 {
1717
mod bar { pub fn p() -> int { 2 } }
1818

1919
pub mod baz {
20-
use test1::foo::*;
21-
use test1::bar::*;
20+
use test1::bar::p;
2221

2322
pub fn my_main() { assert!(p() == 2); }
2423
}
@@ -36,20 +35,7 @@ mod test2 {
3635
}
3736
}
3837

39-
mod test3 {
40-
41-
mod foo { pub fn p() -> int { 1 } }
42-
mod bar { pub fn p() -> int { 2 } }
43-
44-
pub mod baz {
45-
use test3::bar::p;
46-
47-
pub fn my_main() { assert!(p() == 2); }
48-
}
49-
}
50-
5138
fn main() {
5239
test1::baz::my_main();
5340
test2::baz::my_main();
54-
test3::baz::my_main();
5541
}

src/test/run-pass/tcp-connect-timeouts.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#![allow(unused_imports)]
2424

2525
use std::io::*;
26-
use std::io::net::tcp::*;
2726
use std::io::test::*;
2827
use std::io;
2928
use std::time::Duration;

0 commit comments

Comments
 (0)