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

Rollup of 25 pull requests #56547

Closed
wants to merge 82 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
700c83b
Document `From` implementations
Jun 24, 2018
072bca3
Remove 'unsafe' comments
Jun 25, 2018
88a708d
Update comments
Jun 25, 2018
5c747eb
Update style of comments
Jul 26, 2018
e8dafba
Adjust doc comments
Nov 21, 2018
7933628
Remove trailing whitespace
Nov 21, 2018
c209ed8
Improve no result found sentence in doc search
GuillaumeGomez Nov 1, 2018
47b5e23
Introduce ptr::hash for references
dwijnand Nov 26, 2018
86d20f9
FIXME is the new TODO
dwijnand Nov 26, 2018
5558c07
Fix ptr::hex doc example
dwijnand Nov 26, 2018
7b429b0
Fix stability attribute for ptr::hash
dwijnand Nov 27, 2018
8125149
Pick a better variable name for ptr::hash
dwijnand Nov 27, 2018
afb4fbd
Add an assert_eq in ptr::hash's doc example
dwijnand Nov 27, 2018
4a7ffe2
Fix issue number
dwijnand Nov 27, 2018
9755410
Try to fix ptr::hash's doc example
dwijnand Nov 27, 2018
097b5db
Move feature enable in ptr::hash doc example
dwijnand Nov 27, 2018
dd717de
Add crate filtering
GuillaumeGomez Sep 30, 2018
8062c7a
Add test for crate filtering
GuillaumeGomez Sep 30, 2018
afe4107
Add arrow to the crate select box
GuillaumeGomez Nov 29, 2018
1560a75
Refer to the second borrow as the "second borrow".
wildarch Nov 30, 2018
d92287a
Fix some rustc doc links
matthewjasper Nov 30, 2018
4f5b8ea
Remove the `region_map` field from `BorrowSet`
matthewjasper Nov 30, 2018
6000c2e
Use visit_local to find 2PB activations
matthewjasper Nov 30, 2018
d809d21
use top level `fs` functions where appropriate
euclio Nov 16, 2018
23abd18
Fix invalid line number match
GuillaumeGomez Dec 2, 2018
59e9a1e
pass the parameter environment to `traits::find_associated_item`
arielb1 Dec 2, 2018
380dd7d
Add rc::Weak.ptr_eq
Thomasdezeeuw Nov 15, 2018
d4b41fa
Add sync::Weak::ptr_eq
Thomasdezeeuw Nov 15, 2018
38e21f9
Fix link in Weak::new
Thomasdezeeuw Nov 23, 2018
a8a1bf9
Introduce constraint category for yields.
davidtwco Dec 3, 2018
9acfbb2
Fix ICE in region naming.
davidtwco Dec 3, 2018
1fb82b5
Handle existential types in dead code analysis
oli-obk Dec 3, 2018
651373c
data_structures: remove tuple_slice
ljedrz Dec 3, 2018
9c8802d
Explain raw identifer syntax
mark-i-m Dec 2, 2018
0b40be6
link to raw identifiers
mark-i-m Dec 2, 2018
101467c
syntax: `dyn` is a used keyword now
petrochenkov Dec 2, 2018
08f8fae
syntax: Rename some keywords
petrochenkov Dec 2, 2018
d415844
syntax: Remove `#[non_exhaustive]` from `Edition`
petrochenkov Dec 2, 2018
3f253f5
Improve filter test
GuillaumeGomez Dec 3, 2018
d08f7dc
Address review comments
petrochenkov Dec 2, 2018
65aa0a6
Remove redundant clone
sinkuu Nov 28, 2018
bc7c3dc
sort_by_cached_key -> sort_by
sinkuu Nov 30, 2018
6fab3f9
Make ptr::hash take a raw painter like ptr::eq
dwijnand Dec 4, 2018
ad76569
Fix ptr::hash, just hash the raw pointer
dwijnand Dec 4, 2018
450a8a6
Add extra comment slash
Dec 4, 2018
8c4129c
cleanup: remove static lifetimes from consts in libstd
ljedrz Dec 4, 2018
e41e85c
Fix line numbers display
GuillaumeGomez Dec 4, 2018
d0c64bb
cleanup: remove static lifetimes from consts
ljedrz Dec 4, 2018
e448713
generate invalidations from 2-phase-borrow activations
nikomatsakis Dec 4, 2018
f30ba07
adopt polonius-engine 0.6.0
nikomatsakis Dec 4, 2018
9012af6
Utilize `?` instead of `return None`.
frewsxcv Nov 21, 2018
56ace3e
Added a bare-bones eslint config (removing jslint)
JohnHeitmann Dec 4, 2018
5d7cf59
Added trailing newline
JohnHeitmann Dec 5, 2018
3512fb0
Avoid extra copy and syscall in std::env::current_exe
udoprog Dec 5, 2018
6cfbb5b
Remove unused dependency (rustc_lint -> rustc_mir)
sinkuu Dec 5, 2018
3eddc74
Use inner iterator may_have_side_effect for Cloned
KamilaBorowska Dec 5, 2018
a964307
Add a test for cloned side effects
KamilaBorowska Dec 5, 2018
9ee29d9
Rollup merge of #51753 - gruberb:document-from-conversions-libstdpath…
pietroalbini Dec 5, 2018
731e365
Rollup merge of #55563 - GuillaumeGomez:doc-search-sentence, r=QuietM…
pietroalbini Dec 5, 2018
02ec8d0
Rollup merge of #55987 - Thomasdezeeuw:weak-ptr_eq, r=sfackler
pietroalbini Dec 5, 2018
76e8ce2
Rollup merge of #56119 - frewsxcv:frewsxcv-option-carrier, r=TimNN
pietroalbini Dec 5, 2018
ec16058
Rollup merge of #56250 - dwijnand:ptr-hash, r=alexcrichton
pietroalbini Dec 5, 2018
cb6102f
Rollup merge of #56258 - euclio:fs-read-write, r=Mark-Simulacrum
pietroalbini Dec 5, 2018
3f97a7e
Rollup merge of #56332 - GuillaumeGomez:specifi-crate-search, r=Quiet…
pietroalbini Dec 5, 2018
907ed9e
Rollup merge of #56372 - wildarch:issue-55314-second-borrow-ref, r=da…
pietroalbini Dec 5, 2018
3296d51
Rollup merge of #56388 - matthewjasper:more-lexical-mir-cleanup, r=ni…
pietroalbini Dec 5, 2018
5feba0f
Rollup merge of #56424 - mark-i-m:explain-raw, r=Centril
pietroalbini Dec 5, 2018
2e41d46
Rollup merge of #56426 - petrochenkov:syntweak, r=nikomatsakis
pietroalbini Dec 5, 2018
3c0d0ed
Rollup merge of #56446 - arielb1:special-env-implications, r=nikomats…
pietroalbini Dec 5, 2018
1c97c4b
Rollup merge of #56452 - sinkuu:redundant_clone, r=nikic
pietroalbini Dec 5, 2018
d71381a
Rollup merge of #56456 - oli-obk:private_impl_trait, r=cramertj
pietroalbini Dec 5, 2018
647aa6a
Rollup merge of #56460 - davidtwco:issue-55850, r=pnkfelix
pietroalbini Dec 5, 2018
5bfb8bb
Rollup merge of #56466 - ljedrz:delete_tuple_slice, r=nikomatsakis
pietroalbini Dec 5, 2018
13ac1f3
Rollup merge of #56476 - GuillaumeGomez:invalid-line-number-match, r=…
pietroalbini Dec 5, 2018
ab8843d
Rollup merge of #56497 - ljedrz:cleanup_libstd_const_lifetimes, r=ken…
pietroalbini Dec 5, 2018
f39173d
Rollup merge of #56498 - GuillaumeGomez:line-numbers, r=QuietMisdreavus
pietroalbini Dec 5, 2018
97452d9
Rollup merge of #56500 - ljedrz:cleanup_rest_of_const_lifetimes, r=za…
pietroalbini Dec 5, 2018
b1c8db0
Rollup merge of #56507 - nikomatsakis:polonius-integrate, r=matthewja…
pietroalbini Dec 5, 2018
a05de3c
Rollup merge of #56523 - JohnHeitmann:es6, r=GuillaumeGomez
pietroalbini Dec 5, 2018
1095a26
Rollup merge of #56525 - udoprog:linux-current-exe, r=alexcrichton
pietroalbini Dec 5, 2018
37bf0cb
Rollup merge of #56528 - sinkuu:unused_dep, r=Mark-Simulacrum
pietroalbini Dec 5, 2018
45e1ed8
Rollup merge of #56538 - xfix:patch-13, r=bluss
pietroalbini Dec 5, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1587,7 +1587,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "polonius-engine"
version = "0.5.0"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"datafrog 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down Expand Up @@ -1966,7 +1966,7 @@ dependencies = [
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"polonius-engine 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"polonius-engine 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_apfloat 0.0.0",
Expand Down Expand Up @@ -2352,7 +2352,6 @@ dependencies = [
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc 0.0.0",
"rustc_data_structures 0.0.0",
"rustc_mir 0.0.0",
"rustc_target 0.0.0",
"syntax 0.0.0",
"syntax_pos 0.0.0",
Expand Down Expand Up @@ -2406,7 +2405,7 @@ dependencies = [
"graphviz 0.0.0",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log_settings 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"polonius-engine 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"polonius-engine 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc 0.0.0",
"rustc_apfloat 0.0.0",
"rustc_data_structures 0.0.0",
Expand Down Expand Up @@ -3427,7 +3426,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum phf_generator 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)" = "05a079dd052e7b674d21cb31cbb6c05efd56a2cd2827db7692e2f1a507ebd998"
"checksum phf_shared 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)" = "c2261d544c2bb6aa3b10022b0be371b9c7c64f762ef28c6f5d4f1ef6d97b5930"
"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c"
"checksum polonius-engine 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a5b6b0a7f5f4278b991ffd14abce1d01b013121ad297460237ef0a2f08d43201"
"checksum polonius-engine 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "494cc28002fae8ce2604c31c5cc1e73009318a0f6d2bb539a018dc22420a2dd0"
"checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
"checksum pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a029430f0d744bc3d15dd474d591bed2402b645d024583082b9f63bb936dac6"
"checksum pretty_env_logger 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ed8d1e63042e889b85228620629b51c011d380eed2c7e0015f8a644def280c28"
Expand Down
19 changes: 9 additions & 10 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

use std::borrow::Cow;
use std::env;
use std::fs::{self, File};
use std::fs;
use std::io::BufReader;
use std::io::prelude::*;
use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -707,7 +707,7 @@ impl Step for CodegenBackend {
}
let stamp = codegen_backend_stamp(builder, compiler, target, backend);
let codegen_backend = codegen_backend.to_str().unwrap();
t!(t!(File::create(&stamp)).write_all(codegen_backend.as_bytes()));
t!(fs::write(&stamp, &codegen_backend));
}
}

Expand Down Expand Up @@ -796,8 +796,7 @@ fn copy_codegen_backends_to_sysroot(builder: &Builder,

for backend in builder.config.rust_codegen_backends.iter() {
let stamp = codegen_backend_stamp(builder, compiler, target, *backend);
let mut dylib = String::new();
t!(t!(File::open(&stamp)).read_to_string(&mut dylib));
let dylib = t!(fs::read_to_string(&stamp));
let file = Path::new(&dylib);
let filename = file.file_name().unwrap().to_str().unwrap();
// change `librustc_codegen_llvm-xxxxxx.so` to `librustc_codegen_llvm-llvm.so`
Expand Down Expand Up @@ -1137,10 +1136,7 @@ pub fn run_cargo(builder: &Builder,
// contents (the list of files to copy) is different or if any dep's mtime
// is newer then we rewrite the stamp file.
deps.sort();
let mut stamp_contents = Vec::new();
if let Ok(mut f) = File::open(stamp) {
t!(f.read_to_end(&mut stamp_contents));
}
let stamp_contents = fs::read(stamp);
let stamp_mtime = mtime(&stamp);
let mut new_contents = Vec::new();
let mut max = None;
Expand All @@ -1156,7 +1152,10 @@ pub fn run_cargo(builder: &Builder,
}
let max = max.unwrap();
let max_path = max_path.unwrap();
if stamp_contents == new_contents && max <= stamp_mtime {
let contents_equal = stamp_contents
.map(|contents| contents == new_contents)
.unwrap_or_default();
if contents_equal && max <= stamp_mtime {
builder.verbose(&format!("not updating {:?}; contents equal and {:?} <= {:?}",
stamp, max, stamp_mtime));
return deps
Expand All @@ -1166,7 +1165,7 @@ pub fn run_cargo(builder: &Builder,
} else {
builder.verbose(&format!("updating {:?} as deps changed", stamp));
}
t!(t!(File::create(stamp)).write_all(&new_contents));
t!(fs::write(&stamp, &new_contents));
deps
}

Expand Down
7 changes: 2 additions & 5 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@

use std::collections::{HashMap, HashSet};
use std::env;
use std::fs::{self, File};
use std::io::prelude::*;
use std::fs;
use std::path::{Path, PathBuf};
use std::process;
use std::cmp;
Expand Down Expand Up @@ -416,9 +415,7 @@ impl Config {
config.run_host_only = !(flags.host.is_empty() && !flags.target.is_empty());

let toml = file.map(|file| {
let mut f = t!(File::open(&file));
let mut contents = String::new();
t!(f.read_to_string(&mut contents));
let contents = t!(fs::read_to_string(&file));
match toml::from_str(&contents) {
Ok(table) => table,
Err(err) => {
Expand Down
14 changes: 6 additions & 8 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
//! pieces of `rustup.rs`!

use std::env;
use std::fs::{self, File};
use std::io::{Read, Write};
use std::fs;
use std::io::Write;
use std::path::{PathBuf, Path};
use std::process::{Command, Stdio};

Expand Down Expand Up @@ -1510,8 +1510,7 @@ impl Step for Extended {
}

let xform = |p: &Path| {
let mut contents = String::new();
t!(t!(File::open(p)).read_to_string(&mut contents));
let mut contents = t!(fs::read_to_string(p));
if rls_installer.is_none() {
contents = filter(&contents, "rls");
}
Expand All @@ -1522,8 +1521,8 @@ impl Step for Extended {
contents = filter(&contents, "rustfmt");
}
let ret = tmp.join(p.file_name().unwrap());
t!(t!(File::create(&ret)).write_all(contents.as_bytes()));
return ret
t!(fs::write(&ret, &contents));
ret
};

if target.contains("apple-darwin") {
Expand Down Expand Up @@ -1868,8 +1867,7 @@ impl Step for HashSign {
let file = builder.config.dist_gpg_password_file.as_ref().unwrap_or_else(|| {
panic!("\n\nfailed to specify `dist.gpg-password-file` in `config.toml`\n\n")
});
let mut pass = String::new();
t!(t!(File::open(&file)).read_to_string(&mut pass));
let pass = t!(fs::read_to_string(&file));

let today = output(Command::new("date").arg("+%Y-%m-%d"));

Expand Down
14 changes: 6 additions & 8 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
//! `rustdoc`.

use std::collections::HashSet;
use std::fs::{self, File};
use std::io::prelude::*;
use std::fs;
use std::io;
use std::path::{PathBuf, Path};

Expand Down Expand Up @@ -379,12 +378,11 @@ impl Step for Standalone {
let version_info = out.join("version_info.html");

if !builder.config.dry_run && !up_to_date(&version_input, &version_info) {
let mut info = String::new();
t!(t!(File::open(&version_input)).read_to_string(&mut info));
let info = info.replace("VERSION", &builder.rust_release())
.replace("SHORT_HASH", builder.rust_info.sha_short().unwrap_or(""))
.replace("STAMP", builder.rust_info.sha().unwrap_or(""));
t!(t!(File::create(&version_info)).write_all(info.as_bytes()));
let info = t!(fs::read_to_string(&version_input))
.replace("VERSION", &builder.rust_release())
.replace("SHORT_HASH", builder.rust_info.sha_short().unwrap_or(""))
.replace("STAMP", builder.rust_info.sha().unwrap_or(""));
t!(fs::write(&version_info, &info));
}

for file in t!(fs::read_dir(builder.src.join("src/doc"))) {
Expand Down
6 changes: 2 additions & 4 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1067,9 +1067,8 @@ impl Build {

/// Returns the `a.b.c` version that the given package is at.
fn release_num(&self, package: &str) -> String {
let mut toml = String::new();
let toml_file_name = self.src.join(&format!("src/tools/{}/Cargo.toml", package));
t!(t!(File::open(toml_file_name)).read_to_string(&mut toml));
let toml = t!(fs::read_to_string(&toml_file_name));
for line in toml.lines() {
let prefix = "version = \"";
let suffix = "\"";
Expand Down Expand Up @@ -1151,8 +1150,7 @@ impl Build {
}

let mut paths = Vec::new();
let mut contents = Vec::new();
t!(t!(File::open(stamp)).read_to_end(&mut contents));
let contents = t!(fs::read(stamp));
// This is the method we use for extracting paths from the stamp file passed to us. See
// run_cargo for more information (in compile.rs).
for part in contents.split(|b| *b == 0) {
Expand Down
9 changes: 3 additions & 6 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use std::env;
use std::ffi::OsString;
use std::fs::{self, File};
use std::io::{Read, Write};
use std::path::{Path, PathBuf};
use std::process::Command;

Expand Down Expand Up @@ -75,8 +74,7 @@ impl Step for Llvm {
}

let rebuild_trigger = builder.src.join("src/rustllvm/llvm-rebuild-trigger");
let mut rebuild_trigger_contents = String::new();
t!(t!(File::open(&rebuild_trigger)).read_to_string(&mut rebuild_trigger_contents));
let rebuild_trigger_contents = t!(fs::read_to_string(&rebuild_trigger));

let (out_dir, llvm_config_ret_dir) = if emscripten {
let dir = builder.emscripten_llvm_out(target);
Expand All @@ -93,8 +91,7 @@ impl Step for Llvm {
let build_llvm_config = llvm_config_ret_dir
.join(exe("llvm-config", &*builder.config.build));
if done_stamp.exists() {
let mut done_contents = String::new();
t!(t!(File::open(&done_stamp)).read_to_string(&mut done_contents));
let done_contents = t!(fs::read_to_string(&done_stamp));

// If LLVM was already built previously and contents of the rebuild-trigger file
// didn't change from the previous build, then no action is required.
Expand Down Expand Up @@ -261,7 +258,7 @@ impl Step for Llvm {

cfg.build();

t!(t!(File::create(&done_stamp)).write_all(rebuild_trigger_contents.as_bytes()));
t!(fs::write(&done_stamp, &rebuild_trigger_contents));

build_llvm_config
}
Expand Down
7 changes: 2 additions & 5 deletions src/bootstrap/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
use std::collections::HashMap;
use std::env;
use std::ffi::{OsString, OsStr};
use std::fs::{self, File};
use std::io::Read;
use std::fs;
use std::path::PathBuf;
use std::process::Command;

Expand Down Expand Up @@ -235,9 +234,7 @@ $ pacman -R cmake && pacman -S mingw-w64-x86_64-cmake
}

if build.config.channel == "stable" {
let mut stage0 = String::new();
t!(t!(File::open(build.src.join("src/stage0.txt")))
.read_to_string(&mut stage0));
let stage0 = t!(fs::read_to_string(build.src.join("src/stage0.txt")));
if stage0.contains("\ndev:") {
panic!("bootstrapping from a dev compiler in a stable release, but \
should only be bootstrapping from a released compiler!");
Expand Down
9 changes: 3 additions & 6 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
use std::env;
use std::ffi::OsString;
use std::fmt;
use std::fs::{self, File};
use std::io::Read;
use std::fs;
use std::iter;
use std::path::{Path, PathBuf};
use std::process::Command;
Expand Down Expand Up @@ -1427,10 +1426,8 @@ impl Step for ErrorIndex {
}

fn markdown_test(builder: &Builder, compiler: Compiler, markdown: &Path) -> bool {
match File::open(markdown) {
Ok(mut file) => {
let mut contents = String::new();
t!(file.read_to_string(&mut contents));
match fs::read_to_string(markdown) {
Ok(contents) => {
if !contents.contains("```") {
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/grammar/parser-lalr.y
Original file line number Diff line number Diff line change
Expand Up @@ -741,14 +741,14 @@ fn_anon_params
;

fn_params_with_self
: '(' maybe_mut SELF maybe_ty_ascription maybe_comma_params ')' { $$ = mk_node("SelfValue", 3, $2, $4, $5); }
: '(' maybe_mut SELF maybe_ty_ascription maybe_comma_params ')' { $$ = mk_node("SelfLower", 3, $2, $4, $5); }
| '(' '&' maybe_mut SELF maybe_ty_ascription maybe_comma_params ')' { $$ = mk_node("SelfRegion", 3, $3, $5, $6); }
| '(' '&' lifetime maybe_mut SELF maybe_ty_ascription maybe_comma_params ')' { $$ = mk_node("SelfRegion", 4, $3, $4, $6, $7); }
| '(' maybe_params ')' { $$ = mk_node("SelfStatic", 1, $2); }
;

fn_anon_params_with_self
: '(' maybe_mut SELF maybe_ty_ascription maybe_comma_anon_params ')' { $$ = mk_node("SelfValue", 3, $2, $4, $5); }
: '(' maybe_mut SELF maybe_ty_ascription maybe_comma_anon_params ')' { $$ = mk_node("SelfLower", 3, $2, $4, $5); }
| '(' '&' maybe_mut SELF maybe_ty_ascription maybe_comma_anon_params ')' { $$ = mk_node("SelfRegion", 3, $3, $5, $6); }
| '(' '&' lifetime maybe_mut SELF maybe_ty_ascription maybe_comma_anon_params ')' { $$ = mk_node("SelfRegion", 4, $3, $4, $6, $7); }
| '(' maybe_anon_params ')' { $$ = mk_node("SelfStatic", 1, $2); }
Expand Down
49 changes: 48 additions & 1 deletion src/liballoc/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1187,8 +1187,9 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Weak<U>> for Weak<T> {}

impl<T> Weak<T> {
/// Constructs a new `Weak<T>`, without allocating any memory.
/// Calling [`upgrade`][Weak::upgrade] on the return value always gives [`None`].
/// Calling [`upgrade`] on the return value always gives [`None`].
///
/// [`upgrade`]: #method.upgrade
/// [`None`]: ../../std/option/enum.Option.html
///
/// # Examples
Expand Down Expand Up @@ -1260,6 +1261,52 @@ impl<T: ?Sized> Weak<T> {
Some(unsafe { self.ptr.as_ref() })
}
}

/// Returns true if the two `Weak`s point to the same value (not just values
/// that compare as equal).
///
/// # Notes
///
/// Since this compares pointers it means that `Weak::new()` will equal each
/// other, even though they don't point to any value.
///
/// # Examples
///
/// ```
/// #![feature(weak_ptr_eq)]
/// use std::rc::{Rc, Weak};
///
/// let first_rc = Rc::new(5);
/// let first = Rc::downgrade(&first_rc);
/// let second = Rc::downgrade(&first_rc);
///
/// assert!(Weak::ptr_eq(&first, &second));
///
/// let third_rc = Rc::new(5);
/// let third = Rc::downgrade(&third_rc);
///
/// assert!(!Weak::ptr_eq(&first, &third));
/// ```
///
/// Comparing `Weak::new`.
///
/// ```
/// #![feature(weak_ptr_eq)]
/// use std::rc::{Rc, Weak};
///
/// let first = Weak::new();
/// let second = Weak::new();
/// assert!(Weak::ptr_eq(&first, &second));
///
/// let third_rc = Rc::new(());
/// let third = Rc::downgrade(&third_rc);
/// assert!(!Weak::ptr_eq(&first, &third));
/// ```
#[inline]
#[unstable(feature = "weak_ptr_eq", issue = "55981")]
pub fn ptr_eq(this: &Self, other: &Self) -> bool {
this.ptr.as_ptr() == other.ptr.as_ptr()
}
}

#[stable(feature = "rc_weak", since = "1.4.0")]
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ impl String {
return Cow::Borrowed("");
};

const REPLACEMENT: &'static str = "\u{FFFD}";
const REPLACEMENT: &str = "\u{FFFD}";

let mut res = String::with_capacity(v.len());
res.push_str(first_valid);
Expand Down
Loading