shift bindings to accommodate new lifetime/dtor rules.
(My fix to for-loops (21984) did not deal with similar problems in if-let expressions, so those binding shifts stay.)
This commit is contained in:
parent
5936278ed6
commit
bdb9f3e266
|
@ -2196,7 +2196,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||
|
||||
// Search for external modules.
|
||||
if namespace == TypeNS {
|
||||
if let Some(module) = module_.external_module_children.borrow().get(&name).cloned() {
|
||||
// FIXME (21114): In principle unclear `child` *has* to be lifted.
|
||||
let child = module_.external_module_children.borrow().get(&name).cloned();
|
||||
if let Some(module) = child {
|
||||
let name_bindings =
|
||||
Rc::new(Resolver::create_name_bindings_from_module(module));
|
||||
debug!("lower name bindings succeeded");
|
||||
|
@ -2481,7 +2483,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||
|
||||
// Finally, search through external children.
|
||||
if namespace == TypeNS {
|
||||
if let Some(module) = module_.external_module_children.borrow().get(&name).cloned() {
|
||||
// FIXME (21114): In principle unclear `child` *has* to be lifted.
|
||||
let child = module_.external_module_children.borrow().get(&name).cloned();
|
||||
if let Some(module) = child {
|
||||
let name_bindings =
|
||||
Rc::new(Resolver::create_name_bindings_from_module(module));
|
||||
return Success((Target::new(module_,
|
||||
|
|
|
@ -525,7 +525,8 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> {
|
|||
trait_def_id);
|
||||
|
||||
let trait_impls = self.tcx().trait_impls.borrow();
|
||||
let impl_def_ids = match trait_impls.get(&trait_def_id) {
|
||||
let impl_def_ids = trait_impls.get(&trait_def_id);
|
||||
let impl_def_ids = match impl_def_ids {
|
||||
None => { return; }
|
||||
Some(impls) => impls,
|
||||
};
|
||||
|
|
|
@ -50,7 +50,8 @@
|
|||
//! ```rust
|
||||
//! use std::old_io as io;
|
||||
//!
|
||||
//! for line in io::stdin().lock().lines() {
|
||||
//! let mut stdin = io::stdin();
|
||||
//! for line in stdin.lock().lines() {
|
||||
//! print!("{}", line.unwrap());
|
||||
//! }
|
||||
//! ```
|
||||
|
|
|
@ -143,7 +143,8 @@ impl StdinReader {
|
|||
/// ```rust
|
||||
/// use std::old_io;
|
||||
///
|
||||
/// for line in old_io::stdin().lock().lines() {
|
||||
/// let mut stdin = old_io::stdin();
|
||||
/// for line in stdin.lock().lines() {
|
||||
/// println!("{}", line.unwrap());
|
||||
/// }
|
||||
/// ```
|
||||
|
|
|
@ -19,5 +19,6 @@ pub type header_map = HashMap<String, Rc<RefCell<Vec<Rc<String>>>>>;
|
|||
|
||||
// the unused ty param is necessary so this gets monomorphized
|
||||
pub fn request<T>(req: &header_map) {
|
||||
let _x = req["METHOD".to_string()].clone().borrow().clone()[0].clone();
|
||||
let data = req["METHOD".to_string()].clone();
|
||||
let _x = data.borrow().clone()[0].clone();
|
||||
}
|
||||
|
|
|
@ -295,7 +295,9 @@ fn main() {
|
|||
let fd = std::old_io::File::open(&Path::new("shootout-k-nucleotide.data"));
|
||||
get_sequence(&mut std::old_io::BufferedReader::new(fd), ">THREE")
|
||||
} else {
|
||||
get_sequence(&mut *std::old_io::stdin().lock(), ">THREE")
|
||||
let mut stdin = std::old_io::stdin();
|
||||
let mut stdin = stdin.lock();
|
||||
get_sequence(&mut *stdin, ">THREE")
|
||||
};
|
||||
let input = Arc::new(input);
|
||||
|
||||
|
|
|
@ -274,7 +274,9 @@ fn main() {
|
|||
let mut sudoku = if use_default {
|
||||
Sudoku::from_vec(&DEFAULT_SUDOKU)
|
||||
} else {
|
||||
Sudoku::read(&mut *old_io::stdin().lock())
|
||||
let mut stdin = old_io::stdin();
|
||||
let mut stdin = stdin.lock();
|
||||
Sudoku::read(&mut *stdin)
|
||||
};
|
||||
sudoku.solve();
|
||||
sudoku.write(&mut old_io::stdout());
|
||||
|
|
|
@ -37,7 +37,8 @@ fn parent() {
|
|||
}
|
||||
|
||||
fn child() {
|
||||
for line in old_io::stdin().lock().lines() {
|
||||
let mut stdin = old_io::stdin();
|
||||
for line in stdin.lock().lines() {
|
||||
println!("{}", line.unwrap());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,8 @@ fn main() {
|
|||
fn child() {
|
||||
old_io::stdout().write_line("foo").unwrap();
|
||||
old_io::stderr().write_line("bar").unwrap();
|
||||
assert_eq!(old_io::stdin().lock().read_line().err().unwrap().kind, old_io::EndOfFile);
|
||||
let mut stdin = old_io::stdin();
|
||||
assert_eq!(stdin.lock().read_line().err().unwrap().kind, old_io::EndOfFile);
|
||||
}
|
||||
|
||||
fn test() {
|
||||
|
|
|
@ -29,5 +29,5 @@ impl Bar {
|
|||
|
||||
fn main() {
|
||||
let b = RefCell::new(Bar);
|
||||
b.borrow().foo()
|
||||
b.borrow().foo();
|
||||
}
|
||||
|
|
|
@ -22,8 +22,9 @@ struct Point {
|
|||
}
|
||||
|
||||
pub fn main() {
|
||||
let box_5 = box 5u;
|
||||
assert_eq!(Rc::new(5u).to_uint(), Some(5));
|
||||
assert_eq!((box &box &Rc::new(box box &box 5u)).to_uint(), Some(5));
|
||||
assert_eq!((box &box &Rc::new(box box &box_5)).to_uint(), Some(5));
|
||||
let point = Rc::new(Point {x: 2, y: 4});
|
||||
assert_eq!(point.x, 2);
|
||||
assert_eq!(point.y, 4);
|
||||
|
|
Loading…
Reference in New Issue