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 29 pull requests #56325

Closed
wants to merge 79 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
32d07cc
bootstrap: be more explicit on what we collect into. NFC
matthiaskrgr Oct 26, 2018
cc63bd4
atomic::Ordering: Get rid of misleading parts of intro
vorner Nov 17, 2018
7dc0dd2
Drop function parameters in expected order
matthewjasper Nov 18, 2018
28cc944
Reduce the amount of bold text at doc.rust-lang.org
mark-i-m Nov 19, 2018
6674db4
Reuse the `P` in `InvocationCollector::fold_{,opt_}expr`.
nnethercote Nov 20, 2018
b99f9f7
Enclose type in backticks for "non-exhaustive patterns" error
varkor Nov 20, 2018
464c9da
serialize: preallocate VecDeque in Decodable::decode
ljedrz Nov 21, 2018
591607d
String: add a FIXME to from_utf16
ljedrz Nov 21, 2018
1ed9195
fix small doc mistake
antoine-de Nov 21, 2018
83388e8
Update an outdated comment in mir building
oli-obk Nov 21, 2018
5a2a251
Update as_temp.rs
oli-obk Nov 21, 2018
925274a
Update as_temp.rs
oli-obk Nov 21, 2018
f039872
Enclose type in backticks for "reached the recursion limit while auto…
varkor Nov 21, 2018
ec3ac11
Make std::os::unix/linux::fs::MetadataExt::a/m/ctime* documentation c…
ariasuni Nov 21, 2018
af9b057
drop glue takes in mutable references, it should reflect that in its …
RalfJung Nov 22, 2018
e1ca4f6
fix codegen-units tests
RalfJung Nov 22, 2018
d9de72f
miri: restrict fn argument punning to Rust ABI
RalfJung Nov 22, 2018
5c99ae6
Fix ICE with feature self_struct_ctor
estebank Nov 25, 2018
8d76f54
Use opt_def_id instead of having special branch
estebank Nov 25, 2018
79ee8f3
Suggest appropriate place for lifetime when declared after type argum…
estebank Nov 25, 2018
234d043
Move lifetimes before the *first* type argument
estebank Nov 25, 2018
db8540e
Avoid a useless `FxHashSet::insert` in `FileSearch::for_each_lib_sear…
nnethercote Nov 21, 2018
145e2ab
Remove `Session::sysroot()`.
nnethercote Nov 22, 2018
057e6d3
Add TryFrom<&[T]> for [T; $N] where T: Copy
SimonSapin Nov 25, 2018
8e75844
Introduce `SearchPath` and replace `SearchPaths` with `Vec<SearchPath>`.
nnethercote Nov 22, 2018
ca82a82
Avoid regenerating the `Vec<PathBuf>` in `FileSearch::search()`.
nnethercote Nov 20, 2018
2d2b7c0
Make JSON output from -Zprofile-json valid
Mark-Simulacrum Nov 25, 2018
4dd0f66
Replace `FileSearch::for_each_lib_search_path` with `search_paths`.
nnethercote Nov 23, 2018
cc46685
Remove unsafe `unsafe` inner function.
frewsxcv Nov 26, 2018
45dfe43
Emit one diagnostic for multiple misplaced lifetimes
estebank Nov 26, 2018
769d711
add test for issue #21335
euclio Nov 14, 2018
cd20be5
Update outdated code comments in StringReader
jasonl Nov 26, 2018
a1865ed
Add rustc-guide as a submodule
mark-i-m Nov 22, 2018
6494f1e
rustc-guide has moved
mark-i-m Nov 26, 2018
6f028fe
Specify suggestion applicability
estebank Nov 26, 2018
d4a6e73
Use sort_by_cached_key when key the function is not trivial/free
ljedrz Nov 9, 2018
6739c0e
Add missing doc link
GuillaumeGomez Nov 27, 2018
a8f9302
avoid features_untracked
RalfJung Nov 17, 2018
c4e0b89
move stage0.txt to toplevel directory
Keruspe Nov 24, 2018
73b656b
Fix small typo in comment
marius Nov 27, 2018
c75ed34
move feature gate to accepted
mark-i-m Nov 24, 2018
a542e48
remove feature gate
mark-i-m Nov 24, 2018
32aafb2
remove some unused vars
mark-i-m Nov 24, 2018
e97edad
update tests
mark-i-m Nov 24, 2018
f3b29ca
remove unstable book entry
mark-i-m Nov 24, 2018
59ae93d
remove uses of feature gate
mark-i-m Nov 24, 2018
aeede9e
fix test
mark-i-m Nov 25, 2018
e63bd91
Fix a typo in the documentation of std::ffi
polyfloyd Nov 27, 2018
d8190af
Fix alignment of stores to scalar pair
nikic Nov 27, 2018
5d77173
fix test
mark-i-m Nov 28, 2018
2ac258a
Rollup merge of #55391 - matthiaskrgr:bootstrap_cleanup, r=TimNN
pietroalbini Nov 28, 2018
c1f15da
Rollup merge of #55821 - ljedrz:cached_key_sorts, r=michaelwoerister
pietroalbini Nov 28, 2018
7bed15f
Rollup merge of #56014 - euclio:issue-21335, r=nagisa
pietroalbini Nov 28, 2018
21c77dc
Rollup merge of #56021 - RalfJung:track-features, r=oli-obk
pietroalbini Nov 28, 2018
c286be5
Rollup merge of #56023 - vorner:doc/atomic-ordering-strip, r=@stjepang
pietroalbini Nov 28, 2018
fa335e9
Rollup merge of #56044 - matthewjasper:function-param-drop-order, r=c…
pietroalbini Nov 28, 2018
6ca10ea
Rollup merge of #56080 - mark-i-m:patch-2, r=steveklabnik
pietroalbini Nov 28, 2018
0789658
Rollup merge of #56090 - nnethercote:filesearch, r=eddyb
pietroalbini Nov 28, 2018
962e210
Rollup merge of #56114 - varkor:nonexhaustive-backticks, r=nikomatsakis
pietroalbini Nov 28, 2018
5fc9d68
Rollup merge of #56124 - antoine-de:fix_read_to_end_doc_mistake, r=TimNN
pietroalbini Nov 28, 2018
084e837
Rollup merge of #56127 - rust-lang:oli-obk-patch-1, r=nikomatsakis
pietroalbini Nov 28, 2018
d9b5980
Rollup merge of #56131 - ljedrz:assorted, r=RalfJung
pietroalbini Nov 28, 2018
5503033
Rollup merge of #56148 - mark-i-m:rustc-guide-submodule, r=nikomatsakis
pietroalbini Nov 28, 2018
d77bbb4
Rollup merge of #56149 - ariasuni:improve-amctime-doc, r=TimNN
pietroalbini Nov 28, 2018
b2ad3e2
Rollup merge of #56165 - RalfJung:drop-glue-type, r=eddyb,nikomatsakis
pietroalbini Nov 28, 2018
9642325
Rollup merge of #56205 - estebank:ice-ice-baby, r=nikomatsakis
pietroalbini Nov 28, 2018
6e25cfb
Rollup merge of #56216 - SimonSapin:array-tryfrom-slice, r=withoutboats
pietroalbini Nov 28, 2018
2a07404
Rollup merge of #56220 - estebank:suggest-lifetime-move, r=nikomatsakis
pietroalbini Nov 28, 2018
26bc763
Rollup merge of #56223 - Mark-Simulacrum:self-profile-json, r=wesleyw…
pietroalbini Nov 28, 2018
2faaa35
Rollup merge of #56236 - frewsxcv:frewsxcv-unsafe-unsafe, r=cramertj
pietroalbini Nov 28, 2018
24e6fb2
Rollup merge of #56245 - mark-i-m:stabilize_ques_kleene, r=alexcrichton
pietroalbini Nov 28, 2018
ee531da
Rollup merge of #56255 - jasonl:update-old-documents, r=michaelwoerister
pietroalbini Nov 28, 2018
a524143
Rollup merge of #56257 - mark-i-m:rustc-guide-links, r=nikomatsakis
pietroalbini Nov 28, 2018
70567f6
Rollup merge of #56268 - nnethercote:fold_opt_expr-recycle, r=petroch…
pietroalbini Nov 28, 2018
19b10fc
Rollup merge of #56273 - GuillaumeGomez:iterator-fnmut-missing-link, …
pietroalbini Nov 28, 2018
e9fc4ba
Rollup merge of #56285 - Keruspe:stage0, r=alexcrichton
pietroalbini Nov 28, 2018
ebefb1a
Rollup merge of #56289 - marius:patch-1, r=cramertj
pietroalbini Nov 28, 2018
1a4bb2b
Rollup merge of #56294 - polyfloyd:fix-typo-ffi-doc, r=sfackler
pietroalbini Nov 28, 2018
a6e3e85
Rollup merge of #56300 - nikic:issue-56267, r=eddyb
pietroalbini Nov 28, 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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,6 @@
url = https://github.com/rust-lang-nursery/clang.git
branch = rust-release-80-v1

[submodule "src/doc/rustc-guide"]
path = src/doc/rustc-guide
url = https://github.com/rust-lang/rustc-guide.git
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -640,13 +640,13 @@ are:
* **Google!** ([search only in Rust Documentation][gsearchdocs] to find types, traits, etc. quickly)
* Don't be afraid to ask! The Rust community is friendly and helpful.

[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/about-this-guide.html
[rustc guide]: https://rust-lang.github.io/rustc-guide/about-this-guide.html
[gdfrustc]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/
[gsearchdocs]: https://www.google.com/search?q=site:doc.rust-lang.org+your+query+here
[rif]: http://internals.rust-lang.org
[rr]: https://doc.rust-lang.org/book/README.html
[rustforge]: https://forge.rust-lang.org/
[tlgba]: http://tomlee.co/2014/04/a-more-detailed-tour-of-the-rust-compiler/
[ro]: http://www.rustaceans.org/
[rctd]: https://rust-lang-nursery.github.io/rustc-guide/tests/intro.html
[rctd]: https://rust-lang.github.io/rustc-guide/tests/intro.html
[cheatsheet]: https://buildbot2.rust-lang.org/homu/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ Also, you may find the [rustdocs for the compiler itself][rustdocs] useful.
[IRC]: https://en.wikipedia.org/wiki/Internet_Relay_Chat
[#rust]: irc://irc.mozilla.org/rust
[#rust-beginners]: irc://irc.mozilla.org/rust-beginners
[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/about-this-guide.html
[rustc guide]: https://rust-lang.github.io/rustc-guide/about-this-guide.html
[rustdocs]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/

## License
Expand Down
4 changes: 2 additions & 2 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@
# for each target triple.
#target = ["x86_64-unknown-linux-gnu"] # defaults to just the build triple

# Instead of downloading the src/stage0.txt version of Cargo specified, use
# Instead of downloading the stage0.txt version of Cargo specified, use
# this Cargo binary instead to build all Rust code
#cargo = "/path/to/bin/cargo"

# Instead of downloading the src/stage0.txt version of the compiler
# Instead of downloading the stage0.txt version of the compiler
# specified, use this rustc binary instead as the stage0 snapshot compiler.
#rustc = "/path/to/bin/rustc"

Expand Down
2 changes: 1 addition & 1 deletion src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ There is also useful content in the following READMEs, which are gradually being
- https://github.com/rust-lang/rust/tree/master/src/librustc/infer/higher_ranked
- https://github.com/rust-lang/rust/tree/master/src/librustc/infer/lexical_region_resolve

[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/about-this-guide.html
[rustc guide]: https://rust-lang.github.io/rustc-guide/about-this-guide.html
2 changes: 1 addition & 1 deletion src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def run(args, verbose=False, exception=False, **kwargs):

def stage0_data(rust_root):
"""Build a dictionary from stage0.txt"""
nightlies = os.path.join(rust_root, "src/stage0.txt")
nightlies = os.path.join(rust_root, "stage0.txt")
with open(nightlies, 'r') as nightlies:
lines = [line.rstrip() for line in nightlies
if not line.startswith("#")]
Expand Down
3 changes: 1 addition & 2 deletions src/bootstrap/bootstrap_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ class Stage0DataTestCase(unittest.TestCase):
def setUp(self):
self.rust_root = tempfile.mkdtemp()
os.mkdir(os.path.join(self.rust_root, "src"))
with open(os.path.join(self.rust_root, "src",
"stage0.txt"), "w") as stage0:
with open(os.path.join(self.rust_root, "stage0.txt"), "w") as stage0:
stage0.write("#ignore\n\ndate: 2017-06-15\nrustc: beta\ncargo: beta")

def tearDown(self):
Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
//! When you execute `x.py build`, the steps which are executed are:
//!
//! * First, the python script is run. This will automatically download the
//! stage0 rustc and cargo according to `src/stage0.txt`, or use the cached
//! stage0 rustc and cargo according to `stage0.txt`, or use the cached
//! versions if they're available. These are then used to compile rustbuild
//! itself (using Cargo). Finally, control is then transferred to rustbuild.
//!
Expand Down Expand Up @@ -777,10 +777,10 @@ impl Build {
fn cflags(&self, target: Interned<String>, which: GitRepo) -> Vec<String> {
// Filter out -O and /O (the optimization flags) that we picked up from
// cc-rs because the build scripts will determine that for themselves.
let mut base: Vec<String> = self.cc[&target].args().iter()
let mut base = self.cc[&target].args().iter()
.map(|s| s.to_string_lossy().into_owned())
.filter(|s| !s.starts_with("-O") && !s.starts_with("/O"))
.collect::<Vec<_>>();
.collect::<Vec<String>>();

// If we're compiling on macOS then we add a few unconditional flags
// indicating that we want libc++ (more filled out than libstdc++) and
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,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")))
t!(t!(File::open(build.src.join("stage0.txt")))
.read_to_string(&mut stage0));
if stage0.contains("\ndev:") {
panic!("bootstrapping from a dev compiler in a stable release, but \
Expand Down
3 changes: 3 additions & 0 deletions src/doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ nav {
#search-but:hover, #search-input:focus {
border-color: #55a9ff;
}
h2 {
font-size: 18px;
}
</style>

Welcome to an overview of the documentation provided by the Rust project.
Expand Down
1 change: 1 addition & 0 deletions src/doc/rustc-guide
Submodule rustc-guide added at 3a8049
4 changes: 2 additions & 2 deletions src/doc/rustc/src/contributing.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing to rustc

We'd love to have your help improving `rustc`! To that end, we've written [a
whole book](https://rust-lang-nursery.github.io/rustc-guide/) on its
whole book](https://rust-lang.github.io/rustc-guide/) on its
internals, how it works, and how to get started working on it. To learn
more, you'll want to check that out.
more, you'll want to check that out.

This file was deleted.

1 change: 0 additions & 1 deletion src/doc/unstable-book/src/language-features/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ that warns about any item named `lintme`.
```rust,ignore
#![feature(plugin_registrar)]
#![feature(box_syntax, rustc_private)]
#![feature(macro_at_most_once_rep)]
extern crate syntax;
Expand Down
2 changes: 2 additions & 0 deletions src/liballoc/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,8 @@ impl String {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn from_utf16(v: &[u16]) -> Result<String, FromUtf16Error> {
// This isn't done via collect::<Result<_, _>>() for performance reasons.
// FIXME: the function can be simplified again when #48994 is closed.
let mut ret = String::with_capacity(v.len());
for c in decode_utf16(v.iter().cloned()) {
if let Ok(c) = c {
Expand Down
9 changes: 9 additions & 0 deletions src/libcore/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,15 @@ macro_rules! array_impls {
}
}

#[unstable(feature = "try_from", issue = "33417")]
impl<'a, T> TryFrom<&'a [T]> for [T; $N] where T: Copy {
type Error = TryFromSliceError;

fn try_from(slice: &[T]) -> Result<[T; $N], TryFromSliceError> {
<&Self>::try_from(slice).map(|r| *r)
}
}

#[unstable(feature = "try_from", issue = "33417")]
impl<'a, T> TryFrom<&'a [T]> for &'a [T; $N] {
type Error = TryFromSliceError;
Expand Down
3 changes: 2 additions & 1 deletion src/libcore/iter/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ pub trait Iterator {
/// element.
///
/// `map()` transforms one iterator into another, by means of its argument:
/// something that implements `FnMut`. It produces a new iterator which
/// something that implements [`FnMut`]. It produces a new iterator which
/// calls this closure on each element of the original iterator.
///
/// If you are good at thinking in types, you can think of `map()` like this:
Expand All @@ -533,6 +533,7 @@ pub trait Iterator {
/// more idiomatic to use [`for`] than `map()`.
///
/// [`for`]: ../../book/ch03-05-control-flow.html#looping-through-a-collection-with-for
/// [`FnMut`]: ../../std/ops/trait.FnMut.html
///
/// # Examples
///
Expand Down
1 change: 0 additions & 1 deletion src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@
#![feature(never_type)]
#![feature(nll)]
#![feature(exhaustive_patterns)]
#![feature(macro_at_most_once_rep)]
#![feature(no_core)]
#![feature(on_unimplemented)]
#![feature(optin_builtin_traits)]
Expand Down
78 changes: 78 additions & 0 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1989,6 +1989,19 @@ big endian.
```
let value = ", stringify!($SelfT), "::from_be_bytes(", $be_bytes, ");
assert_eq!(value, ", $swap_op, ");
```

When starting from a slice rather than an array, fallible conversion APIs can be used:

```
#![feature(try_from)]
use std::convert::TryInto;

fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());
*input = rest;
", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap())
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[rustc_const_unstable(feature = "const_int_conversion")]
Expand All @@ -2008,6 +2021,19 @@ little endian.
```
let value = ", stringify!($SelfT), "::from_le_bytes(", $le_bytes, ");
assert_eq!(value, ", $swap_op, ");
```

When starting from a slice rather than an array, fallible conversion APIs can be used:

```
#![feature(try_from)]
use std::convert::TryInto;

fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());
*input = rest;
", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap())
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[rustc_const_unstable(feature = "const_int_conversion")]
Expand Down Expand Up @@ -2037,6 +2063,19 @@ let value = ", stringify!($SelfT), "::from_ne_bytes(if cfg!(target_endian = \"bi
", $le_bytes, "
});
assert_eq!(value, ", $swap_op, ");
```

When starting from a slice rather than an array, fallible conversion APIs can be used:

```
#![feature(try_from)]
use std::convert::TryInto;

fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());
*input = rest;
", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap())
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[rustc_const_unstable(feature = "const_int_conversion")]
Expand Down Expand Up @@ -3719,6 +3758,19 @@ big endian.
```
let value = ", stringify!($SelfT), "::from_be_bytes(", $be_bytes, ");
assert_eq!(value, ", $swap_op, ");
```

When starting from a slice rather than an array, fallible conversion APIs can be used:

```
#![feature(try_from)]
use std::convert::TryInto;

fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());
*input = rest;
", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap())
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[rustc_const_unstable(feature = "const_int_conversion")]
Expand All @@ -3738,6 +3790,19 @@ little endian.
```
let value = ", stringify!($SelfT), "::from_le_bytes(", $le_bytes, ");
assert_eq!(value, ", $swap_op, ");
```

When starting from a slice rather than an array, fallible conversion APIs can be used:

```
#![feature(try_from)]
use std::convert::TryInto;

fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());
*input = rest;
", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap())
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[rustc_const_unstable(feature = "const_int_conversion")]
Expand Down Expand Up @@ -3767,6 +3832,19 @@ let value = ", stringify!($SelfT), "::from_ne_bytes(if cfg!(target_endian = \"bi
", $le_bytes, "
});
assert_eq!(value, ", $swap_op, ");
```

When starting from a slice rather than an array, fallible conversion APIs can be used:

```
#![feature(try_from)]
use std::convert::TryInto;

fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());
*input = rest;
", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap())
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[rustc_const_unstable(feature = "const_int_conversion")]
Expand Down
14 changes: 12 additions & 2 deletions src/libcore/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,22 @@ pub use intrinsics::write_bytes;
/// i.e., you do not usually have to worry about such issues unless you call `drop_in_place`
/// manually.
#[stable(feature = "drop_in_place", since = "1.8.0")]
#[inline(always)]
pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
real_drop_in_place(&mut *to_drop)
}

// The real `drop_in_place` -- the one that gets called implicitly when variables go
// out of scope -- should have a safe reference and not a raw pointer as argument
// type. When we drop a local variable, we access it with a pointer that behaves
// like a safe reference; transmuting that to a raw pointer does not mean we can
// actually access it with raw pointers.
#[lang = "drop_in_place"]
#[allow(unconditional_recursion)]
pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
unsafe fn real_drop_in_place<T: ?Sized>(to_drop: &mut T) {
// Code here does not matter - this is replaced by the
// real drop glue by the compiler.
drop_in_place(to_drop);
real_drop_in_place(to_drop)
}

/// Creates a null raw pointer.
Expand Down
7 changes: 2 additions & 5 deletions src/libcore/str/lossy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,15 @@ impl<'a> Iterator for Utf8LossyChunksIter<'a> {
}

const TAG_CONT_U8: u8 = 128;
fn unsafe_get(xs: &[u8], i: usize) -> u8 {
unsafe { *xs.get_unchecked(i) }
}
fn safe_get(xs: &[u8], i: usize) -> u8 {
if i >= xs.len() { 0 } else { unsafe_get(xs, i) }
*xs.get(i).unwrap_or(&0)
}

let mut i = 0;
while i < self.source.len() {
let i_ = i;

let byte = unsafe_get(self.source, i);
let byte = unsafe { *self.source.get_unchecked(i) };
i += 1;

if byte < 128 {
Expand Down
Loading