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 13 pull requests #48955

Merged
merged 37 commits into from
Mar 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
f1c1fc2
rephrase UnsafeCell doc
NovemberZulu Feb 14, 2018
b9b8249
fix tidy checks
NovemberZulu Feb 14, 2018
cfad25e
Clarify interfaction between File::set_len and file cursor
jethrogb Feb 23, 2018
273166e
remove italic
NovemberZulu Feb 27, 2018
d9b8724
style fix
NovemberZulu Feb 27, 2018
50f5ea9
Simplify
NovemberZulu Feb 27, 2018
ff6754c
fix tidy checks
NovemberZulu Feb 27, 2018
78789ad
and some more tidy checks
NovemberZulu Feb 27, 2018
55cc9a4
Remember state of top-level collapse toggle widget
focusaurus Mar 1, 2018
2dd81c8
Rename doc collapse sentinal to rustdoc-collapse
focusaurus Mar 1, 2018
f9c5b1f
Update Feature Request instructions
klnusbaum Mar 3, 2018
ca1c91b
Synchronizing with code of conduct in rust-www
davidalber Mar 7, 2018
fe557ee
another rewrite
NovemberZulu Mar 8, 2018
fbcd2f5
tidy. Again
NovemberZulu Mar 8, 2018
55be283
and again :(
NovemberZulu Mar 8, 2018
a63bf3b
Add missing urls
GuillaumeGomez Mar 9, 2018
c1a73d2
tidy: Add a check for stray `.stderr` and `.stdout` files in UI test …
petrochenkov Mar 9, 2018
7dc71ec
Remove auto trait implementation section when empty
GuillaumeGomez Mar 9, 2018
9334175
remove linker arguments from L4Re target
humenda Mar 10, 2018
9fd941e
add stub for retrieving number of CPUs
humenda Mar 10, 2018
9b59985
in which some labels and notes are upgraded to structured suggestions
zackmdavis Mar 11, 2018
c033c6e
Fix hygene issue when deriving Debug
Phlosioneer Mar 11, 2018
f2a8556
Update stdsimd module
alexcrichton Mar 9, 2018
fdb5181
Rollup merge of #48201 - NovemberZulu:master, r=steveklabnik
kennytm Mar 12, 2018
7bd8f6e
Rollup merge of #48705 - klnusbaum:update_rfc_process, r=aturon
kennytm Mar 12, 2018
f84cab4
Rollup merge of #48725 - humenda:master, r=nikomatsakis
kennytm Mar 12, 2018
e22a994
Rollup merge of #48824 - davidalber:update-conduct, r=steveklabnik
kennytm Mar 12, 2018
5d09189
Rollup merge of #48877 - GuillaumeGomez:vec-missing-links, r=QuietMis…
kennytm Mar 12, 2018
3d2db9b
Rollup merge of #48880 - petrochenkov:badstderr, r=kennytm
kennytm Mar 12, 2018
2d13cc4
Rollup merge of #48887 - alexcrichton:update-stdsimd, r=kennytm
kennytm Mar 12, 2018
14574db
Rollup merge of #48928 - zackmdavis:span_suggestion_field_day, r=este…
kennytm Mar 12, 2018
34d9ffe
Rollup merge of #48934 - Phlosioneer:42453-debug-hygene, r=petrochenkov
kennytm Mar 12, 2018
bda5a45
Add missing links
GuillaumeGomez Mar 12, 2018
684c6d1
Rollup merge of #48480 - jethrogb:patch-5, r=alexcrichton
kennytm Mar 12, 2018
15d71d3
Rollup merge of #48631 - focusaurus:remember-collapse-setting, r=Quie…
kennytm Mar 12, 2018
e30d89d
Rollup merge of #48898 - GuillaumeGomez:remove-empty-section, r=Quiet…
kennytm Mar 12, 2018
99d0ac0
Rollup merge of #48954 - GuillaumeGomez:missing-links-fmt, r=QuietMis…
kennytm Mar 12, 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
4 changes: 2 additions & 2 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ A version of this document [can be found online](https://www.rust-lang.org/condu
* Please be kind and courteous. There's no need to be mean or rude.
* Respect that people have differences of opinion and that every design or implementation choice carries a trade-off and numerous costs. There is seldom a right answer.
* Please keep unstructured critique to a minimum. If you have solid ideas you want to experiment with, make a fork and see how it works.
* We will exclude you from interaction if you insult, demean or harass anyone. That is not welcome behaviour. We interpret the term "harassment" as including the definition in the <a href="http://citizencodeofconduct.org/">Citizen Code of Conduct</a>; if you have any lack of clarity about what might be included in that concept, please read their definition. In particular, we don't tolerate behavior that excludes people in socially marginalized groups.
* We will exclude you from interaction if you insult, demean or harass anyone. That is not welcome behavior. We interpret the term "harassment" as including the definition in the <a href="http://citizencodeofconduct.org/">Citizen Code of Conduct</a>; if you have any lack of clarity about what might be included in that concept, please read their definition. In particular, we don't tolerate behavior that excludes people in socially marginalized groups.
* Private harassment is also unacceptable. No matter who you are, if you feel you have been or are being harassed or made uncomfortable by a community member, please contact one of the channel ops or any of the [Rust moderation team][mod_team] immediately. Whether you're a regular contributor or a newcomer, we care about making this community a safe place for you and we've got your back.
* Likewise any spamming, trolling, flaming, baiting or other attention-stealing behaviour is not welcome.
* Likewise any spamming, trolling, flaming, baiting or other attention-stealing behavior is not welcome.

## Moderation

Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ As a reminder, all contributors are expected to follow our [Code of Conduct][coc
## Feature Requests
[feature-requests]: #feature-requests

To request a change to the way that the Rust language works, please open an
issue in the [RFCs repository](https://github.com/rust-lang/rfcs/issues/new)
rather than this one. New features and other significant language changes
must go through the RFC process.
To request a change to the way the Rust language works, please head over
to the [RFCs repository](https://github.com/rust-lang/rfcs) and view the
[README](https://github.com/rust-lang/rfcs/blob/master/README.md)
for instructions.

## Bug Reports
[bug-reports]: #bug-reports
Expand Down
21 changes: 14 additions & 7 deletions src/liballoc/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1212,8 +1212,9 @@ impl<T: Clone> Vec<T> {
/// difference, with each additional slot filled with `value`.
/// If `new_len` is less than `len`, the `Vec` is simply truncated.
///
/// This method requires `Clone` to clone the passed value. If you'd
/// rather create a value with `Default` instead, see [`resize_default`].
/// This method requires [`Clone`] to be able clone the passed value. If
/// you'd rather create a value with [`Default`] instead, see
/// [`resize_default`].
///
/// # Examples
///
Expand All @@ -1227,6 +1228,8 @@ impl<T: Clone> Vec<T> {
/// assert_eq!(vec, [1, 2]);
/// ```
///
/// [`Clone`]: ../../std/clone/trait.Clone.html
/// [`Default`]: ../../std/default/trait.Default.html
/// [`resize_default`]: #method.resize_default
#[stable(feature = "vec_resize", since = "1.5.0")]
pub fn resize(&mut self, new_len: usize, value: T) {
Expand All @@ -1244,7 +1247,7 @@ impl<T: Clone> Vec<T> {
/// Iterates over the slice `other`, clones each element, and then appends
/// it to this `Vec`. The `other` vector is traversed in-order.
///
/// Note that this function is same as `extend` except that it is
/// Note that this function is same as [`extend`] except that it is
/// specialized to work with slices instead. If and when Rust gets
/// specialization this function will likely be deprecated (but still
/// available).
Expand All @@ -1256,6 +1259,8 @@ impl<T: Clone> Vec<T> {
/// vec.extend_from_slice(&[2, 3, 4]);
/// assert_eq!(vec, [1, 2, 3, 4]);
/// ```
///
/// [`extend`]: #method.extend
#[stable(feature = "vec_extend_from_slice", since = "1.6.0")]
pub fn extend_from_slice(&mut self, other: &[T]) {
self.spec_extend(other.iter())
Expand All @@ -1266,12 +1271,11 @@ impl<T: Default> Vec<T> {
/// Resizes the `Vec` in-place so that `len` is equal to `new_len`.
///
/// If `new_len` is greater than `len`, the `Vec` is extended by the
/// difference, with each additional slot filled with `Default::default()`.
/// difference, with each additional slot filled with [`Default::default()`].
/// If `new_len` is less than `len`, the `Vec` is simply truncated.
///
/// This method uses `Default` to create new values on every push. If
/// you'd rather `Clone` a given value, use [`resize`].
///
/// This method uses [`Default`] to create new values on every push. If
/// you'd rather [`Clone`] a given value, use [`resize`].
///
/// # Examples
///
Expand All @@ -1288,6 +1292,9 @@ impl<T: Default> Vec<T> {
/// ```
///
/// [`resize`]: #method.resize
/// [`Default::default()`]: ../../std/default/trait.Default.html#tymethod.default
/// [`Default`]: ../../std/default/trait.Default.html
/// [`Clone`]: ../../std/clone/trait.Clone.html
#[unstable(feature = "vec_resize_default", issue = "41758")]
pub fn resize_default(&mut self, new_len: usize) {
let len = self.len();
Expand Down
51 changes: 36 additions & 15 deletions src/libcore/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1203,21 +1203,42 @@ impl<'a, T: ?Sized + fmt::Display> fmt::Display for RefMut<'a, T> {
/// The `UnsafeCell<T>` type is the only legal way to obtain aliasable data that is considered
/// mutable. In general, transmuting an `&T` type into an `&mut T` is considered undefined behavior.
///
/// The compiler makes optimizations based on the knowledge that `&T` is not mutably aliased or
/// mutated, and that `&mut T` is unique. When building abstractions like `Cell`, `RefCell`,
/// `Mutex`, etc, you need to turn these optimizations off. `UnsafeCell` is the only legal way
/// to do this. When `UnsafeCell<T>` is immutably aliased, it is still safe to obtain a mutable
/// reference to its interior and/or to mutate it. However, it is up to the abstraction designer
/// to ensure that no two mutable references obtained this way are active at the same time, and
/// that there are no active mutable references or mutations when an immutable reference is obtained
/// from the cell. This is often done via runtime checks.
/// If you have a reference `&SomeStruct`, then normally in Rust all fields of `SomeStruct` are
/// immutable. The compiler makes optimizations based on the knowledge that `&T` is not mutably
/// aliased or mutated, and that `&mut T` is unique. `UnsafeCel<T>` is the only core language
/// feature to work around this restriction. All other types that allow internal mutability, such as
/// `Cell<T>` and `RefCell<T>` use `UnsafeCell` to wrap their internal data.
///
/// Note that while mutating or mutably aliasing the contents of an `& UnsafeCell<T>` is
/// okay (provided you enforce the invariants some other way); it is still undefined behavior
/// to have multiple `&mut UnsafeCell<T>` aliases.
/// The `UnsafeCell` API itself is technically very simple: it gives you a raw pointer `*mut T` to
/// its contents. It is up to _you_ as the abstraction designer to use that raw pointer correctly.
///
/// The precise Rust aliasing rules are somewhat in flux, but the main points are not contentious:
///
/// - If you create a safe reference with lifetime `'a` (either a `&T` or `&mut T` reference) that
/// is accessible by safe code (for example, because you returned it), then you must not access
/// the data in any way that contradicts that reference for the remainder of `'a`. For example, that
/// means that if you take the `*mut T` from an `UnsafeCell<T>` and case it to an `&T`, then until
/// that reference's lifetime expires, the data in `T` must remain immutable (modulo any
/// `UnsafeCell` data found within `T`, of course). Similarly, if you create an `&mut T` reference
/// that is released to safe code, then you must not access the data within the `UnsafeCell` until
/// that reference expires.
///
/// - At all times, you must avoid data races, meaning that if multiple threads have access to
/// the same `UnsafeCell`, then any writes must have a proper happens-before relation to all other
/// accesses (or use atomics).
///
/// To assist with proper design, the following scenarios are explicitly declared legal
/// for single-threaded code:
///
/// Types like `Cell<T>` and `RefCell<T>` use this type to wrap their internal data.
/// 1. A `&T` reference can be released to safe code and there it can co-exit with other `&T`
/// references, but not with a `&mut T`
///
/// 2. A `&mut T` reference may be released to safe code, provided neither other `&mut T` nor `&T`
/// co-exist with it. A `&mut T` must always be unique.
///
/// Note that while mutating or mutably aliasing the contents of an `& UnsafeCell<T>` is
/// okay (provided you enforce the invariants some other way), it is still undefined behavior
/// to have multiple `&mut UnsafeCell<T>` aliases.
///
/// # Examples
///
Expand Down Expand Up @@ -1282,9 +1303,9 @@ impl<T: ?Sized> UnsafeCell<T> {
/// Gets a mutable pointer to the wrapped value.
///
/// This can be cast to a pointer of any kind.
/// Ensure that the access is unique when casting to
/// `&mut T`, and ensure that there are no mutations or mutable
/// aliases going on when casting to `&T`
/// Ensure that the access is unique (no active references, mutable or not)
/// when casting to `&mut T`, and ensure that there are no mutations
/// or mutable aliases going on when casting to `&T`
///
/// # Examples
///
Expand Down
12 changes: 8 additions & 4 deletions src/libcore/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -684,18 +684,16 @@ pub trait Octal {
///
/// The `Binary` trait should format its output as a number in binary.
///
/// For primitive signed integers (`i8` to `i128`, and `isize`),
/// For primitive signed integers ([`i8`] to [`i128`], and [`isize`]),
/// negative values are formatted as the two’s complement representation.
///
/// The alternate flag, `#`, adds a `0b` in front of the output.
///
/// For more information on formatters, see [the module-level documentation][module].
///
/// [module]: ../../std/fmt/index.html
///
/// # Examples
///
/// Basic usage with `i32`:
/// Basic usage with [`i32`]:
///
/// ```
/// let x = 42; // 42 is '101010' in binary
Expand Down Expand Up @@ -725,6 +723,12 @@ pub trait Octal {
///
/// println!("l as binary is: {:b}", l);
/// ```
///
/// [module]: ../../std/fmt/index.html
/// [`i8`]: ../../std/primitive.i8.html
/// [`i128`]: ../../std/primitive.i128.html
/// [`isize`]: ../../std/primitive.isize.html
/// [`i32`]: ../../std/primitive.i32.html
#[stable(feature = "rust1", since = "1.0.0")]
pub trait Binary {
/// Formats the value using the given formatter.
Expand Down
2 changes: 2 additions & 0 deletions src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@
#![feature(concat_idents)]
#![feature(const_fn)]
#![feature(custom_attribute)]
#![feature(doc_cfg)]
#![feature(doc_spotlight)]
#![feature(fn_must_use)]
#![feature(fundamental)]
#![feature(i128_type)]
#![feature(inclusive_range_syntax)]
Expand Down
71 changes: 16 additions & 55 deletions src/librustc_back/target/l4re_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,74 +8,35 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use PanicStrategy;
use LinkerFlavor;
use PanicStrategy;
use target::{LinkArgs, TargetOptions};
use std::default::Default;
use std::env;
use std::process::Command;
//use std::process::Command;

// Use GCC to locate code for crt* libraries from the host, not from L4Re. Note
// that a few files also come from L4Re, for these, the function shouldn't be
// used. This uses GCC for the location of the file, but GCC is required for L4Re anyway.
fn get_path_or(filename: &str) -> String {
let child = Command::new("gcc")
.arg(format!("-print-file-name={}", filename)).output()
.expect("Failed to execute GCC");
String::from_utf8(child.stdout)
.expect("Couldn't read path from GCC").trim().into()
}
//fn get_path_or(filename: &str) -> String {
// let child = Command::new("gcc")
// .arg(format!("-print-file-name={}", filename)).output()
// .expect("Failed to execute GCC");
// String::from_utf8(child.stdout)
// .expect("Couldn't read path from GCC").trim().into()
//}

pub fn opts() -> Result<TargetOptions, String> {
let l4re_lib_path = env::var_os("L4RE_LIBDIR").ok_or("Unable to find L4Re \
library directory: L4RE_LIBDIR not set.")?.into_string().unwrap();
let mut pre_link_args = LinkArgs::new();
pre_link_args.insert(LinkerFlavor::Ld, vec![
format!("-T{}/main_stat.ld", l4re_lib_path),
"--defsym=__executable_start=0x01000000".to_string(),
"--defsym=__L4_KIP_ADDR__=0x6ffff000".to_string(),
format!("{}/crt1.o", l4re_lib_path),
format!("{}/crti.o", l4re_lib_path),
get_path_or("crtbeginT.o"),
]);
let mut post_link_args = LinkArgs::new();
post_link_args.insert(LinkerFlavor::Ld, vec![
format!("{}/l4f/libpthread.a", l4re_lib_path),
format!("{}/l4f/libc_be_sig.a", l4re_lib_path),
format!("{}/l4f/libc_be_sig_noop.a", l4re_lib_path),
format!("{}/l4f/libc_be_socket_noop.a", l4re_lib_path),
format!("{}/l4f/libc_be_fs_noop.a", l4re_lib_path),
format!("{}/l4f/libc_be_sem_noop.a", l4re_lib_path),
format!("{}/l4f/libl4re-vfs.o.a", l4re_lib_path),
format!("{}/l4f/lib4re.a", l4re_lib_path),
format!("{}/l4f/lib4re-util.a", l4re_lib_path),
format!("{}/l4f/libc_support_misc.a", l4re_lib_path),
format!("{}/l4f/libsupc++.a", l4re_lib_path),
format!("{}/l4f/lib4shmc.a", l4re_lib_path),
format!("{}/l4f/lib4re-c.a", l4re_lib_path),
format!("{}/l4f/lib4re-c-util.a", l4re_lib_path),
get_path_or("libgcc_eh.a"),
format!("{}/l4f/libdl.a", l4re_lib_path),
"--start-group".to_string(),
format!("{}/l4f/libl4util.a", l4re_lib_path),
format!("{}/l4f/libc_be_l4re.a", l4re_lib_path),
format!("{}/l4f/libuc_c.a", l4re_lib_path),
format!("{}/l4f/libc_be_l4refile.a", l4re_lib_path),
"--end-group".to_string(),
format!("{}/l4f/libl4sys.a", l4re_lib_path),
"-gc-sections".to_string(),
get_path_or("crtend.o"),
format!("{}/crtn.o", l4re_lib_path),
]);
pub fn opts() -> TargetOptions {
let mut args = LinkArgs::new();
args.insert(LinkerFlavor::Gcc, vec![]);

Ok(TargetOptions {
TargetOptions {
executables: true,
has_elf_tls: false,
exe_allocation_crate: None,
panic_strategy: PanicStrategy::Abort,
pre_link_args,
post_link_args,
linker: Some("ld".to_string()),
pre_link_args: args,
target_family: Some("unix".to_string()),
.. Default::default()
})
}
}
2 changes: 1 addition & 1 deletion src/librustc_back/target/x86_64_unknown_l4re_uclibc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use LinkerFlavor;
use target::{Target, TargetResult};

pub fn target() -> TargetResult {
let mut base = super::l4re_base::opts()?;
let mut base = super::l4re_base::opts();
base.cpu = "x86-64".to_string();
base.max_atomic_width = Some(64);

Expand Down
8 changes: 4 additions & 4 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3096,10 +3096,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
};
}
ty::TyRawPtr(..) => {
err.note(&format!("`{0}` is a native pointer; perhaps you need to deref \
with `(*{0}).{1}`",
self.tcx.hir.node_to_pretty_string(base.id),
field.node));
let base = self.tcx.hir.node_to_pretty_string(base.id);
let msg = format!("`{}` is a native pointer; try dereferencing it", base);
let suggestion = format!("(*{}).{}", base, field.node);
err.span_suggestion(field.span, &msg, suggestion);
}
_ => {}
}
Expand Down
18 changes: 10 additions & 8 deletions src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3181,14 +3181,16 @@ fn render_assoc_items(w: &mut fmt::Formatter,
render_impls(cx, w, concrete, containing_item)?;
write!(w, "</div>")?;

write!(w, "
<h2 id='synthetic-implementations' class='small-section-header'>
Auto Trait Implementations<a href='#synthetic-implementations' class='anchor'></a>
</h2>
<div id='synthetic-implementations-list'>
")?;
render_impls(cx, w, synthetic, containing_item)?;
write!(w, "</div>")?;
if !synthetic.is_empty() {
write!(w, "
<h2 id='synthetic-implementations' class='small-section-header'>
Auto Trait Implementations<a href='#synthetic-implementations' class='anchor'></a>
</h2>
<div id='synthetic-implementations-list'>
")?;
render_impls(cx, w, synthetic, containing_item)?;
write!(w, "</div>")?;
}
}
Ok(())
}
Expand Down
6 changes: 6 additions & 0 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1628,6 +1628,7 @@
function toggleAllDocs() {
var toggle = document.getElementById("toggle-all-docs");
if (hasClass(toggle, "will-expand")) {
updateLocalStorage("rustdoc-collapse", "false");
removeClass(toggle, "will-expand");
onEveryMatchingChild(toggle, "inner", function(e) {
e.innerHTML = labelForToggleButton(false);
Expand All @@ -1637,6 +1638,7 @@
collapseDocs(e, "show");
});
} else {
updateLocalStorage("rustdoc-collapse", "true");
addClass(toggle, "will-expand");
onEveryMatchingChild(toggle, "inner", function(e) {
e.innerHTML = labelForToggleButton(true);
Expand Down Expand Up @@ -1988,6 +1990,10 @@
window.onresize = function() {
hideSidebar();
};

if (getCurrentValue("rustdoc-collapse") === "true") {
toggleAllDocs();
}
}());

// Sets the focus on the search bar at the top of the page
Expand Down
4 changes: 4 additions & 0 deletions src/libstd/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,10 @@ impl File {
/// will be extended to `size` and have all of the intermediate data filled
/// in with 0s.
///
/// The file's cursor isn't changed. In particular, if the cursor was at the
/// end and the file is shrunk using this operation, the cursor will now be
/// past the end.
///
/// # Errors
///
/// This function will return an error if the file is not opened for writing.
Expand Down
Loading