Skip to content

Commit 3f19108

Browse files
committed
---
yaml --- r: 274127 b: refs/heads/stable c: c786091 h: refs/heads/master i: 274125: 64b7ddf 274123: 65c2905 274119: 3fb4212 274111: 6302e7e
1 parent 76d0b8b commit 3f19108

File tree

11 files changed

+32
-130
lines changed

11 files changed

+32
-130
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: c0221c8897db309a79990367476177b1230bb264
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 54475e950cf3db909c4dec4a30c72f7636ab4e07
32+
refs/heads/stable: c78609134c7cef5a616943e5ec79cfc0ce946140
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/libcore/str/mod.rs

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -244,34 +244,6 @@ pub fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> {
244244
Ok(unsafe { from_utf8_unchecked(v) })
245245
}
246246

247-
/// Forms a str from a pointer and a length.
248-
///
249-
/// The `len` argument is the number of bytes in the string.
250-
///
251-
/// # Safety
252-
///
253-
/// This function is unsafe as there is no guarantee that the given pointer is
254-
/// valid for `len` bytes, nor whether the lifetime inferred is a suitable
255-
/// lifetime for the returned str.
256-
///
257-
/// The data must be valid UTF-8
258-
///
259-
/// `p` must be non-null, even for zero-length str.
260-
///
261-
/// # Caveat
262-
///
263-
/// The lifetime for the returned str is inferred from its usage. To
264-
/// prevent accidental misuse, it's suggested to tie the lifetime to whichever
265-
/// source lifetime is safe in the context, such as by providing a helper
266-
/// function taking the lifetime of a host value for the str, or by explicit
267-
/// annotation.
268-
/// Performs the same functionality as `from_raw_parts`, except that a mutable
269-
/// str is returned.
270-
///
271-
unsafe fn from_raw_parts_mut<'a>(p: *mut u8, len: usize) -> &'a mut str {
272-
mem::transmute::<&mut [u8], &mut str>(slice::from_raw_parts_mut(p, len))
273-
}
274-
275247
/// Converts a slice of bytes to a string slice without checking
276248
/// that the string contains valid UTF-8.
277249
///
@@ -1871,10 +1843,10 @@ impl StrExt for str {
18711843
// is_char_boundary checks that the index is in [0, .len()]
18721844
if self.is_char_boundary(mid) {
18731845
let len = self.len();
1874-
let ptr = self.as_ptr() as *mut u8;
18751846
unsafe {
1876-
(from_raw_parts_mut(ptr, mid),
1877-
from_raw_parts_mut(ptr.offset(mid as isize), len - mid))
1847+
let self2: &mut str = mem::transmute_copy(&self);
1848+
(self.slice_mut_unchecked(0, mid),
1849+
self2.slice_mut_unchecked(mid, len))
18781850
}
18791851
} else {
18801852
slice_error_fail(self, 0, mid)

branches/stable/src/librustc_mir/build/expr/as_rvalue.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ impl<'a,'tcx> Builder<'a,'tcx> {
4444
}
4545
ExprKind::Repeat { value, count } => {
4646
let value_operand = unpack!(block = this.as_operand(block, value));
47-
let count = this.as_constant(count);
4847
block.and(Rvalue::Repeat(value_operand, count))
4948
}
5049
ExprKind::Borrow { region, borrow_kind, arg } => {

branches/stable/src/librustc_mir/hair/cx/expr.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,14 +325,11 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr {
325325

326326
hir::ExprRepeat(ref v, ref c) => ExprKind::Repeat {
327327
value: v.to_ref(),
328-
count: Expr {
328+
count: Constant {
329329
ty: cx.tcx.expr_ty(c),
330-
temp_lifetime: None,
331330
span: c.span,
332-
kind: ExprKind::Literal {
333-
literal: cx.const_eval_literal(c)
334-
}
335-
}.to_ref()
331+
literal: cx.const_eval_literal(c)
332+
}
336333
},
337334
hir::ExprRet(ref v) =>
338335
ExprKind::Return { value: v.to_ref() },

branches/stable/src/librustc_mir/hair/mod.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
//! unit-tested and separated from the Rust source and compiler data
1515
//! structures.
1616
17-
use rustc::mir::repr::{BinOp, BorrowKind, Field, Literal, Mutability, UnOp, ItemKind};
17+
use rustc::mir::repr::{Constant, BinOp, BorrowKind, Field, Literal, Mutability, UnOp, ItemKind};
1818
use rustc::middle::const_eval::ConstVal;
1919
use rustc::middle::def_id::DefId;
2020
use rustc::middle::region::CodeExtent;
@@ -213,10 +213,7 @@ pub enum ExprKind<'tcx> {
213213
},
214214
Repeat {
215215
value: ExprRef<'tcx>,
216-
// FIXME(#29789): Add a separate hair::Constant<'tcx> so this could be more explicit about
217-
// its contained data. Currently this should only contain expression of ExprKind::Literal
218-
// kind.
219-
count: ExprRef<'tcx>,
216+
count: Constant<'tcx>,
220217
},
221218
Vec {
222219
fields: Vec<ExprRef<'tcx>>,
@@ -341,7 +338,6 @@ pub struct FieldPattern<'tcx> {
341338
pub field: Field,
342339
pub pattern: Pattern<'tcx>,
343340
}
344-
345341
///////////////////////////////////////////////////////////////////////////
346342
// The Mirror trait
347343

branches/stable/src/librustc_resolve/build_reduced_graph.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -510,9 +510,9 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
510510
self.structs.insert(variant_def_id, Vec::new());
511511
}
512512

513-
// Variants are always treated as importable to allow them to be glob used.
514-
// All variants are defined in both type and value namespaces as future-proofing.
515513
let child = self.add_child(name, parent, ForbidDuplicateTypesAndValues, variant.span);
514+
// variants are always treated as importable to allow them to be glob
515+
// used
516516
child.define_value(Def::Variant(item_id, self.ast_map.local_def_id(variant.node.data.id())),
517517
variant.span,
518518
DefModifiers::PUBLIC | DefModifiers::IMPORTABLE | variant_modifiers);
@@ -618,14 +618,15 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
618618
Def::Variant(_, variant_id) => {
619619
debug!("(building reduced graph for external crate) building variant {}",
620620
final_ident);
621-
// Variants are always treated as importable to allow them to be glob used.
622-
// All variants are defined in both type and value namespaces as future-proofing.
621+
// variants are always treated as importable to allow them to be
622+
// glob used
623623
let modifiers = DefModifiers::PUBLIC | DefModifiers::IMPORTABLE;
624-
child_name_bindings.define_type(def, DUMMY_SP, modifiers);
625-
child_name_bindings.define_value(def, DUMMY_SP, modifiers);
626624
if self.session.cstore.variant_kind(variant_id) == Some(VariantKind::Struct) {
625+
child_name_bindings.define_type(def, DUMMY_SP, modifiers);
627626
// Not adding fields for variants as they are not accessed with a self receiver
628627
self.structs.insert(variant_id, Vec::new());
628+
} else {
629+
child_name_bindings.define_value(def, DUMMY_SP, modifiers);
629630
}
630631
}
631632
Def::Fn(..) |

branches/stable/src/test/auxiliary/variant-namespacing.rs

Lines changed: 0 additions & 15 deletions
This file was deleted.

branches/stable/src/test/compile-fail/empty-struct-braces-pat-1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ fn main() {
3939
XEmpty1 => () // Not an error, `XEmpty1` is interpreted as a new binding
4040
}
4141
match xe3 {
42-
XE::XEmpty3 => () //~ ERROR `XE::XEmpty3` does not name a tuple variant or a tuple struct
42+
XE::XEmpty3 => () //~ ERROR no associated item named `XEmpty3` found for type
4343
}
4444
}

branches/stable/src/test/compile-fail/empty-struct-braces-pat-3.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ fn main() {
3636
E::Empty3(..) => () //~ ERROR `E::Empty3` does not name a tuple variant or a tuple struct
3737
}
3838
match xe3 {
39-
XE::XEmpty3(..) => () //~ ERROR `XE::XEmpty3` does not name a tuple variant or a tuple
39+
XE::XEmpty3(..) => () //~ ERROR no associated item named `XEmpty3` found for type
4040
}
4141
}

branches/stable/src/test/compile-fail/variant-namespacing.rs

Lines changed: 0 additions & 49 deletions
This file was deleted.

branches/stable/src/test/run-pass/empty-struct-braces.rs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ fn xcrate() {
9595
let e2: XEmpty2 = XEmpty2 {};
9696
let e2: XEmpty2 = XEmpty2;
9797
let e3: XE = XE::XEmpty3 {};
98-
let e4: XE = XE::XEmpty4 {};
98+
// FIXME: Commented out tests are waiting for PR 30882 (fixes for variant namespaces)
99+
// let e4: XE = XE::XEmpty4 {};
99100
let e4: XE = XE::XEmpty4;
100101

101102
match e1 {
@@ -108,10 +109,10 @@ fn xcrate() {
108109
XE::XEmpty3 {} => {}
109110
_ => {}
110111
}
111-
match e4 {
112-
XE::XEmpty4 {} => {}
113-
_ => {}
114-
}
112+
// match e4 {
113+
// XE::XEmpty4 {} => {}
114+
// _ => {}
115+
// }
115116

116117
match e1 {
117118
XEmpty1 { .. } => {}
@@ -123,18 +124,18 @@ fn xcrate() {
123124
XE::XEmpty3 { .. } => {}
124125
_ => {}
125126
}
126-
match e4 {
127-
XE::XEmpty4 { .. } => {}
128-
_ => {}
129-
}
127+
// match e4 {
128+
// XE::XEmpty4 { .. } => {}
129+
// _ => {}
130+
// }
130131

131132
match e2 {
132133
XEmpty2 => {}
133134
}
134-
match e4 {
135-
XE::XEmpty4 => {}
136-
_ => {}
137-
}
135+
// match e4 {
136+
// XE::XEmpty4 => {}
137+
// _ => {}
138+
// }
138139

139140
let e11: XEmpty1 = XEmpty1 { ..e1 };
140141
let e22: XEmpty2 = XEmpty2 { ..e2 };

0 commit comments

Comments
 (0)