Skip to content

Commit 5c75b48

Browse files
committed
---
yaml --- r: 274681 b: refs/heads/stable c: 8b95b0a h: refs/heads/master i: 274679: bfe2211
1 parent b930f6d commit 5c75b48

File tree

24 files changed

+317
-194
lines changed

24 files changed

+317
-194
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: 38fa06bc9528d88b2eaf2b082514368a96654f3e
32+
refs/heads/stable: 8b95b0a6f98bc58f9a8b39caa8c681d1500c2e9b
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/liballoc/arc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,9 @@ impl<T: ?Sized> Deref for Arc<T> {
380380
}
381381

382382
impl<T: Clone> Arc<T> {
383-
/// Make a mutable reference into the given `Arc<T>` by cloning the inner
384-
/// data if the `Arc<T>` doesn't have one strong reference and no weak
385-
/// references.
383+
/// Make a mutable reference into the given `Arc<T>`.
384+
/// If the `Arc<T>` has more than one strong reference, or any weak
385+
/// references, the inner data is cloned.
386386
///
387387
/// This is also referred to as a copy-on-write.
388388
///

branches/stable/src/libcollections/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
2727
test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))]
2828

29-
#![allow(trivial_casts)]
3029
#![cfg_attr(test, allow(deprecated))] // rand
3130
#![cfg_attr(not(stage0), deny(warnings))]
3231

branches/stable/src/libcollections/string.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -479,16 +479,15 @@ impl String {
479479
}
480480
}
481481

482-
/// Converts a slice of bytes to a `String`, including invalid characters.
482+
/// Converts a slice of bytes to a string, including invalid characters.
483483
///
484-
/// A string slice ([`&str`]) is made of bytes ([`u8`]), and a slice of
485-
/// bytes ([`&[u8]`][byteslice]) is made of bytes, so this function converts between
486-
/// the two. Not all byte slices are valid string slices, however: [`&str`]
487-
/// requires that it is valid UTF-8. During this conversion,
484+
/// Strings are made of bytes ([`u8`]), and a slice of bytes
485+
/// ([`&[u8]`][byteslice]) is made of bytes, so this function converts
486+
/// between the two. Not all byte slices are valid strings, however: strings
487+
/// are required to be valid UTF-8. During this conversion,
488488
/// `from_utf8_lossy()` will replace any invalid UTF-8 sequences with
489489
/// `U+FFFD REPLACEMENT CHARACTER`, which looks like this: �
490490
///
491-
/// [`&str`]: ../primitive.str.html
492491
/// [`u8`]: ../primitive.u8.html
493492
/// [byteslice]: ../primitive.slice.html
494493
///
@@ -499,10 +498,13 @@ impl String {
499498
///
500499
/// [`from_utf8_unchecked()`]: struct.String.html#method.from_utf8_unchecked
501500
///
502-
/// If you need a [`&str`] instead of a `String`, consider
503-
/// [`str::from_utf8()`].
501+
/// This function returns a [`Cow<'a, str>`]. If our byte slice is invalid
502+
/// UTF-8, then we need to insert the replacement characters, which will
503+
/// change the size of the string, and hence, require a `String`. But if
504+
/// it's already valid UTF-8, we don't need a new allocation. This return
505+
/// type allows us to handle both cases.
504506
///
505-
/// [`str::from_utf8()`]: ../str/fn.from_utf8.html
507+
/// [`Cow<'a, str>`]: ../borrow/enum.Cow.html
506508
///
507509
/// # Examples
508510
///
@@ -512,8 +514,7 @@ impl String {
512514
/// // some bytes, in a vector
513515
/// let sparkle_heart = vec![240, 159, 146, 150];
514516
///
515-
/// // We know these bytes are valid, so we'll use `unwrap()`.
516-
/// let sparkle_heart = String::from_utf8(sparkle_heart).unwrap();
517+
/// let sparkle_heart = String::from_utf8_lossy(&sparkle_heart);
517518
///
518519
/// assert_eq!("💖", sparkle_heart);
519520
/// ```

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,26 +1414,20 @@ impl<T> Pointer for *const T {
14141414
#[stable(feature = "rust1", since = "1.0.0")]
14151415
impl<T> Pointer for *mut T {
14161416
fn fmt(&self, f: &mut Formatter) -> Result {
1417-
// FIXME(#23542) Replace with type ascription.
1418-
#![allow(trivial_casts)]
14191417
Pointer::fmt(&(*self as *const T), f)
14201418
}
14211419
}
14221420

14231421
#[stable(feature = "rust1", since = "1.0.0")]
14241422
impl<'a, T> Pointer for &'a T {
14251423
fn fmt(&self, f: &mut Formatter) -> Result {
1426-
// FIXME(#23542) Replace with type ascription.
1427-
#![allow(trivial_casts)]
14281424
Pointer::fmt(&(*self as *const T), f)
14291425
}
14301426
}
14311427

14321428
#[stable(feature = "rust1", since = "1.0.0")]
14331429
impl<'a, T> Pointer for &'a mut T {
14341430
fn fmt(&self, f: &mut Formatter) -> Result {
1435-
// FIXME(#23542) Replace with type ascription.
1436-
#![allow(trivial_casts)]
14371431
Pointer::fmt(&(&**self as *const T), f)
14381432
}
14391433
}

branches/stable/src/libcore/mem.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,5 @@ pub const POST_DROP_USIZE: usize = POST_DROP_U64 as usize;
578578
#[inline]
579579
#[stable(feature = "rust1", since = "1.0.0")]
580580
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
581-
// FIXME(#23542) Replace with type ascription.
582-
#![allow(trivial_casts)]
583581
ptr::read(src as *const T as *const U)
584582
}

branches/stable/src/librustc/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@
4343
#![feature(time2)]
4444
#![cfg_attr(test, feature(test))]
4545

46-
#![allow(trivial_casts)]
47-
4846
extern crate arena;
4947
extern crate core;
5048
extern crate flate;

branches/stable/src/librustc/middle/infer/region_inference/mod.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,14 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
11051105
for _ in 0..num_vars {
11061106
graph.add_node(());
11071107
}
1108-
let dummy_idx = graph.add_node(());
1108+
1109+
// Issue #30438: two distinct dummy nodes, one for incoming
1110+
// edges (dummy_source) and another for outgoing edges
1111+
// (dummy_sink). In `dummy -> a -> b -> dummy`, using one
1112+
// dummy node leads one to think (erroneously) there exists a
1113+
// path from `b` to `a`. Two dummy nodes sidesteps the issue.
1114+
let dummy_source = graph.add_node(());
1115+
let dummy_sink = graph.add_node(());
11091116

11101117
for (constraint, _) in constraints.iter() {
11111118
match *constraint {
@@ -1115,10 +1122,10 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
11151122
*constraint);
11161123
}
11171124
ConstrainRegSubVar(_, b_id) => {
1118-
graph.add_edge(dummy_idx, NodeIndex(b_id.index as usize), *constraint);
1125+
graph.add_edge(dummy_source, NodeIndex(b_id.index as usize), *constraint);
11191126
}
11201127
ConstrainVarSubReg(a_id, _) => {
1121-
graph.add_edge(NodeIndex(a_id.index as usize), dummy_idx, *constraint);
1128+
graph.add_edge(NodeIndex(a_id.index as usize), dummy_sink, *constraint);
11221129
}
11231130
}
11241131
}

branches/stable/src/librustc/session/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ pub enum PrintRequest {
163163
FileNames,
164164
Sysroot,
165165
CrateName,
166+
Cfg,
166167
}
167168

168169
pub enum Input {
@@ -1105,6 +1106,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
11051106
"crate-name" => PrintRequest::CrateName,
11061107
"file-names" => PrintRequest::FileNames,
11071108
"sysroot" => PrintRequest::Sysroot,
1109+
"cfg" => PrintRequest::Cfg,
11081110
req => {
11091111
early_error(error_format, &format!("unknown print request `{}`", req))
11101112
}

branches/stable/src/librustc_driver/lib.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,25 @@ impl RustcDefaultCalls {
518518
.to_string_lossy());
519519
}
520520
}
521+
PrintRequest::Cfg => {
522+
for cfg in config::build_configuration(sess) {
523+
match cfg.node {
524+
ast::MetaWord(ref word) => println!("{}", word),
525+
ast::MetaNameValue(ref name, ref value) => {
526+
println!("{}=\"{}\"", name, match value.node {
527+
ast::LitStr(ref s, _) => s,
528+
_ => continue,
529+
});
530+
}
531+
// Right now there are not and should not be any
532+
// MetaList items in the configuration returned by
533+
// `build_configuration`.
534+
ast::MetaList(..) => {
535+
panic!("MetaList encountered in default cfg")
536+
}
537+
}
538+
}
539+
}
521540
}
522541
}
523542
return Compilation::Stop;

branches/stable/src/librustc_llvm/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#![allow(non_camel_case_types)]
1313
#![allow(non_snake_case)]
1414
#![allow(dead_code)]
15-
#![allow(trivial_casts)]
1615

1716
#![crate_name = "rustc_llvm"]
1817
#![unstable(feature = "rustc_private", issue = "27812")]

branches/stable/src/librustc_mir/mir_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ extern crate rustc_front;
2323
use build;
2424
use graphviz;
2525
use pretty;
26-
use transform::*;
26+
use transform::{simplify_cfg, MirPass};
2727
use rustc::dep_graph::DepNode;
2828
use rustc::mir::repr::Mir;
2929
use hair::cx::Cx;

0 commit comments

Comments
 (0)