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 9 pull requests #45822

Merged
merged 26 commits into from
Nov 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
af1e4f6
add missing docs for MetadataExt
GuillaumeGomez Oct 23, 2017
71534c4
RwLock guards are Sync if T is
RalfJung Nov 1, 2017
5687000
Update the std::thread docs and clarify that panics can nowadays be c…
sdroege Nov 2, 2017
283b4a1
Use ` instead of ' for function names
sdroege Nov 2, 2017
a12f511
Mention that panics can't possibly be caught when compiling with pani…
sdroege Nov 2, 2017
b86bba5
Make join a link to the function's documentation
sdroege Nov 2, 2017
784528b
rustbuild: don't try to install rls if ToolState is not Testing
Keruspe Oct 28, 2017
6363b06
Update reference link in doc's 404
Havvy Nov 5, 2017
5abc524
rustdoc: add #[allow(unused)] to every doctest
QuietMisdreavus Nov 4, 2017
ce2768a
add #![allow(unused)] to the playground link rustdoc tests
QuietMisdreavus Nov 5, 2017
45a0aa4
Pretty print parens around casts on the LHS of '<'
harpocrates Nov 5, 2017
de959af
Handle anon lifetime arg being returned with named lifetime return type
estebank Nov 4, 2017
005d14d
Added tests
harpocrates Nov 5, 2017
3761c0d
Fix comments
harpocrates Nov 6, 2017
c3ea358
Display all emission types in error msg if user inputs invalid option.
frewsxcv Nov 5, 2017
805333b
review comments
estebank Nov 7, 2017
aa38a1e
Update comments in cast-lt.pp
harpocrates Nov 7, 2017
8074361
Rollup merge of #45470 - GuillaumeGomez:unix-metadata-ext, r=QuietMis…
kennytm Nov 7, 2017
843dc4b
Rollup merge of #45588 - Keruspe:master, r=alexcrichton
kennytm Nov 7, 2017
eae3671
Rollup merge of #45682 - RalfJung:rwlock-guards, r=alexcrichton
kennytm Nov 7, 2017
264bfc4
Rollup merge of #45714 - sdroege:thread-panic-docs, r=dtolnay
kennytm Nov 7, 2017
d8238e4
Rollup merge of #45751 - estebank:issue-44684, r=nikomatsakis
kennytm Nov 7, 2017
4b2a5da
Rollup merge of #45764 - QuietMisdreavus:rustdoc-doctest-lints, r=Gui…
kennytm Nov 7, 2017
6c8a2f6
Rollup merge of #45778 - Havvy:patch-1, r=steveklabnik
kennytm Nov 7, 2017
1683b83
Rollup merge of #45782 - frewsxcv:frewsxcv-shorthands-helpers, r=mani…
kennytm Nov 7, 2017
0d53ecd
Rollup merge of #45784 - harpocrates:fix/print-parens-cast-lt, r=kennytm
kennytm Nov 7, 2017
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
7 changes: 5 additions & 2 deletions src/bootstrap/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,11 @@ install!((self, builder, _config),
install_cargo(builder, self.stage, self.target);
};
Rls, "rls", _config.extended, only_hosts: true, {
builder.ensure(dist::Rls { stage: self.stage, target: self.target });
install_rls(builder, self.stage, self.target);
if builder.ensure(dist::Rls { stage: self.stage, target: self.target }).is_some() {
install_rls(builder, self.stage, self.target);
} else {
println!("skipping Install RLS stage{} ({})", self.stage, self.target);
}
};
Analysis, "analysis", _config.extended, only_hosts: false, {
builder.ensure(dist::Analysis {
Expand Down
2 changes: 1 addition & 1 deletion src/doc/not_found.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Some things that might be helpful to you though:
# Reference

* [The Rust official site](https://www.rust-lang.org)
* [The Rust reference](https://doc.rust-lang.org/reference.html)
* [The Rust reference](https://doc.rust-lang.org/reference/index.html)

# Docs

Expand Down
9 changes: 9 additions & 0 deletions src/librustc/hir/print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1254,6 +1254,15 @@ impl<'a> State<'a> {
Fixity::None => (prec + 1, prec + 1),
};

let left_prec = match (&lhs.node, op.node) {
// These cases need parens: `x as i32 < y` has the parser thinking that `i32 < y` is
// the beginning of a path type. It starts trying to parse `x as (i32 < y ...` instead
// of `(x as i32) < ...`. We need to convince it _not_ to do that.
(&hir::ExprCast { .. }, hir::BinOp_::BiLt) |
(&hir::ExprCast { .. }, hir::BinOp_::BiShl) => parser::PREC_FORCE_PAREN,
_ => left_prec,
};

self.print_expr_maybe_paren(lhs, left_prec)?;
self.s.space()?;
self.word_space(op.node.as_str())?;
Expand Down
55 changes: 36 additions & 19 deletions src/librustc/infer/error_reporting/different_lifetimes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,42 @@ use hir::intravisit::{self, Visitor, NestedVisitorMap};
use infer::error_reporting::util::AnonymousArgInfo;

impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
// This method prints the error message for lifetime errors when both the concerned regions
// are anonymous.
// Consider a case where we have
// fn foo(x: &mut Vec<&u8>, y: &u8)
// { x.push(y); }.
// The example gives
// fn foo(x: &mut Vec<&u8>, y: &u8) {
// --- --- these references are declared with different lifetimes...
// x.push(y);
// ^ ...but data from `y` flows into `x` here
// It has been extended for the case of structs too.
// Consider the example
// struct Ref<'a> { x: &'a u32 }
// fn foo(mut x: Vec<Ref>, y: Ref) {
// --- --- these structs are declared with different lifetimes...
// x.push(y);
// ^ ...but data from `y` flows into `x` here
// }
// It will later be extended to trait objects.
/// Print the error message for lifetime errors when both the concerned regions are anonymous.
///
/// Consider a case where we have
///
/// ```no_run
/// fn foo(x: &mut Vec<&u8>, y: &u8) {
/// x.push(y);
/// }
/// ```
///
/// The example gives
///
/// ```text
/// fn foo(x: &mut Vec<&u8>, y: &u8) {
/// --- --- these references are declared with different lifetimes...
/// x.push(y);
/// ^ ...but data from `y` flows into `x` here
/// ```
///
/// It has been extended for the case of structs too.
///
/// Consider the example
///
/// ```no_run
/// struct Ref<'a> { x: &'a u32 }
/// ```
///
/// ```text
/// fn foo(mut x: Vec<Ref>, y: Ref) {
/// --- --- these structs are declared with different lifetimes...
/// x.push(y);
/// ^ ...but data from `y` flows into `x` here
/// }
/// ````
///
/// It will later be extended to trait objects.
pub fn try_report_anon_anon_conflict(&self, error: &RegionResolutionError<'tcx>) -> bool {
let (span, sub, sup) = match *error {
ConcreteFailure(ref origin, sub, sup) => (origin.span(), sub, sup),
Expand Down
16 changes: 5 additions & 11 deletions src/librustc/infer/error_reporting/named_anon_conflict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,15 @@ use infer::region_inference::RegionResolutionError;
use ty;

impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
// This method generates the error message for the case when
// the function arguments consist of a named region and an anonymous
// region and corresponds to `ConcreteFailure(..)`
/// When given a `ConcreteFailure` for a function with arguments containing a named region and
/// an anonymous region, emit an descriptive diagnostic error.
pub fn try_report_named_anon_conflict(&self, error: &RegionResolutionError<'tcx>) -> bool {
let (span, sub, sup) = match *error {
ConcreteFailure(ref origin, sub, sup) => (origin.span(), sub, sup),
_ => return false, // inapplicable
};

debug!("try_report_named_anon_conflict(sub={:?}, sup={:?})",
sub,
sup);
debug!("try_report_named_anon_conflict(sub={:?}, sup={:?})", sub, sup);

// Determine whether the sub and sup consist of one named region ('a)
// and one anonymous (elided) region. If so, find the parameter arg
Expand All @@ -53,10 +50,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
};

debug!("try_report_named_anon_conflict: named = {:?}", named);
debug!("try_report_named_anon_conflict: anon_arg_info = {:?}",
anon_arg_info);
debug!("try_report_named_anon_conflict: region_info = {:?}",
region_info);
debug!("try_report_named_anon_conflict: anon_arg_info = {:?}", anon_arg_info);
debug!("try_report_named_anon_conflict: region_info = {:?}", region_info);

let (arg, new_ty, br, is_first, scope_def_id, is_impl_item) = (anon_arg_info.arg,
anon_arg_info.arg_ty,
Expand Down Expand Up @@ -101,6 +96,5 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
.span_label(span, format!("lifetime `{}` required", named))
.emit();
return true;

}
}
1 change: 1 addition & 0 deletions src/librustc/infer/error_reporting/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
_ => false,
}
}
ty::ReEarlyBound(_) => true,
_ => false,
}
}
Expand Down
48 changes: 35 additions & 13 deletions src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,34 @@ impl OutputType {
}
}

fn from_shorthand(shorthand: &str) -> Option<Self> {
Some(match shorthand {
"asm" => OutputType::Assembly,
"llvm-ir" => OutputType::LlvmAssembly,
"mir" => OutputType::Mir,
"llvm-bc" => OutputType::Bitcode,
"obj" => OutputType::Object,
"metadata" => OutputType::Metadata,
"link" => OutputType::Exe,
"dep-info" => OutputType::DepInfo,
_ => return None,
})
}

fn shorthands_display() -> String {
format!(
"`{}`, `{}`, `{}`, `{}`, `{}`, `{}`, `{}`, `{}`",
OutputType::Bitcode.shorthand(),
OutputType::Assembly.shorthand(),
OutputType::LlvmAssembly.shorthand(),
OutputType::Mir.shorthand(),
OutputType::Object.shorthand(),
OutputType::Metadata.shorthand(),
OutputType::Exe.shorthand(),
OutputType::DepInfo.shorthand(),
)
}

pub fn extension(&self) -> &'static str {
match *self {
OutputType::Bitcode => "bc",
Expand Down Expand Up @@ -1485,19 +1513,13 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
for list in matches.opt_strs("emit") {
for output_type in list.split(',') {
let mut parts = output_type.splitn(2, '=');
let output_type = match parts.next().unwrap() {
"asm" => OutputType::Assembly,
"llvm-ir" => OutputType::LlvmAssembly,
"mir" => OutputType::Mir,
"llvm-bc" => OutputType::Bitcode,
"obj" => OutputType::Object,
"metadata" => OutputType::Metadata,
"link" => OutputType::Exe,
"dep-info" => OutputType::DepInfo,
part => {
early_error(error_format, &format!("unknown emission type: `{}`",
part))
}
let shorthand = parts.next().unwrap();
let output_type = match OutputType::from_shorthand(shorthand) {
Some(output_type) => output_type,
None => early_error(error_format, &format!(
"unknown emission type: `{}` - expected one of: {}",
shorthand, OutputType::shorthands_display(),
)),
};
let path = parts.next().map(PathBuf::from);
output_types.insert(output_type, path);
Expand Down
16 changes: 12 additions & 4 deletions src/librustdoc/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,15 +337,23 @@ pub fn make_test(s: &str,

let mut prog = String::new();

// First push any outer attributes from the example, assuming they
// are intended to be crate attributes.
prog.push_str(&crate_attrs);
if opts.attrs.is_empty() {
// If there aren't any attributes supplied by #![doc(test(attr(...)))], then allow some
// lints that are commonly triggered in doctests. The crate-level test attributes are
// commonly used to make tests fail in case they trigger warnings, so having this there in
// that case may cause some tests to pass when they shouldn't have.
prog.push_str("#![allow(unused)]\n");
}

// Next, any attributes for other aspects such as lints.
// Next, any attributes that came from the crate root via #![doc(test(attr(...)))].
for attr in &opts.attrs {
prog.push_str(&format!("#![{}]\n", attr));
}

// Now push any outer attributes from the example, assuming they
// are intended to be crate attributes.
prog.push_str(&crate_attrs);

// Don't inject `extern crate std` because it's already injected by the
// compiler.
if !s.contains("extern crate") && !opts.no_crate_inject && cratename != Some("std") {
Expand Down
11 changes: 8 additions & 3 deletions src/libstd/sync/rwlock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

use cell::UnsafeCell;
use fmt;
use marker;
use mem;
use ops::{Deref, DerefMut};
use ptr;
Expand Down Expand Up @@ -102,7 +101,10 @@ pub struct RwLockReadGuard<'a, T: ?Sized + 'a> {
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: ?Sized> !marker::Send for RwLockReadGuard<'a, T> {}
impl<'a, T: ?Sized> !Send for RwLockReadGuard<'a, T> {}

#[stable(feature = "rwlock_guard_sync", since = "1.23.0")]
unsafe impl<'a, T: ?Sized + Sync> Sync for RwLockReadGuard<'a, T> {}

/// RAII structure used to release the exclusive write access of a lock when
/// dropped.
Expand All @@ -121,7 +123,10 @@ pub struct RwLockWriteGuard<'a, T: ?Sized + 'a> {
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: ?Sized> !marker::Send for RwLockWriteGuard<'a, T> {}
impl<'a, T: ?Sized> !Send for RwLockWriteGuard<'a, T> {}

#[stable(feature = "rwlock_guard_sync", since = "1.23.0")]
unsafe impl<'a, T: ?Sized + Sync> Sync for RwLockWriteGuard<'a, T> {}

impl<T> RwLock<T> {
/// Creates a new instance of an `RwLock<T>` which is unlocked.
Expand Down
Loading