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 15 pull requests #54146

Merged
merged 38 commits into from
Sep 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
6ff72a1
AMDGPU call abi info.
DiamondLovesYou Jul 19, 2018
1c0603e
Actually enable the amdgpu component if present.
DiamondLovesYou Jul 19, 2018
bfddede
AMDGPU ignores `noinline` when it slaps `alwaysinline` everywhere.
DiamondLovesYou Jul 19, 2018
66e8e19
Fix an AMDGPU related load bit range metadata assertion.
DiamondLovesYou Jul 19, 2018
b8c6030
Implemented map_or_else for Result<T, E>
ivanbakel Aug 29, 2018
5eb6791
Corrected feature name for map_or_else
ivanbakel Aug 29, 2018
71b16d8
Corrected bad typing in Result::map_or_else doc
ivanbakel Aug 29, 2018
3eda905
Corrected feature status of Result::map_or_else
ivanbakel Aug 29, 2018
6ff4f79
Corrected type variable output T -> U in Result::map_or_else
ivanbakel Aug 29, 2018
79408c3
Added feature attribute to example code in map_or_else doc
ivanbakel Aug 29, 2018
8bbe178
A few cleanups and minor improvements to rustc_passes
ljedrz Sep 7, 2018
aa4f73c
Update documentation for fill_buf in std::io::BufRead
Sep 7, 2018
0ec351d
`&CStr`, not `CStr`, is the counterpart of `&str`
nagisa Sep 8, 2018
597c065
Document .0 to unpack the value from Wrapping
sourcefrog Sep 8, 2018
7f6b608
Stabilization change for mod.rs
blitzerr Sep 9, 2018
7eb0ef0
simplify ordering for Kind
toidiu Sep 9, 2018
88fe8ac
docs: Use dollar sign for all bash prompts
behnam Sep 9, 2018
7acd4b1
Remove documentation about proc_macro being bare-bones
dtolnay Sep 9, 2018
d3e5685
rustdoc: Remove generated blanket impls from trait pages
ollie27 Sep 9, 2018
c549e65
Reexport CheckLintNameResult
flip1995 Sep 10, 2018
abe0f02
fix typos in growth algo description
v-stickykeys Sep 10, 2018
af0f822
Update LLVM to fix GlobalISel dbg.declare
cuviper Sep 11, 2018
8a580ba
Recover proper regression test for issue #16278.
pnkfelix Sep 11, 2018
6b55f04
Rollup merge of #52514 - DiamondLovesYou:amdgpu-fixes, r=eddyb
kennytm Sep 12, 2018
605948f
Rollup merge of #53703 - sourcefrog:doc-wrapping, r=frewsxcv
kennytm Sep 12, 2018
4f62077
Rollup merge of #53777 - ivanbakel:result_map_or_else, r=alexcrichton
kennytm Sep 12, 2018
b365de9
Rollup merge of #54031 - ljedrz:cleanup_passes, r=oli-obk
kennytm Sep 12, 2018
3c9e884
Rollup merge of #54046 - snaedis:issue-48022, r=steveklabnik
kennytm Sep 12, 2018
de2c0f9
Rollup merge of #54064 - nagisa:tiny-typo, r=sfackler
kennytm Sep 12, 2018
e7b45a0
Rollup merge of #54072 - blitzerr:master, r=Mark-Simulacrum
kennytm Sep 12, 2018
61fe064
Rollup merge of #54073 - behnam:docs-1, r=frewsxcv
kennytm Sep 12, 2018
74b8188
Rollup merge of #54074 - toidiu:ak-spimplifyOrd, r=eddyb
kennytm Sep 12, 2018
85b6bf9
Rollup merge of #54085 - dtolnay:bare, r=alexcrichton
kennytm Sep 12, 2018
40d9740
Rollup merge of #54087 - ollie27:rustdoc_blanket_impl, r=QuietMisdreavus
kennytm Sep 12, 2018
2889015
Rollup merge of #54106 - flip1995:pub_checklintnameresult, r=Manishearth
kennytm Sep 12, 2018
13ec061
Rollup merge of #54107 - thevaleriemack:master, r=Mark-Simulacrum
kennytm Sep 12, 2018
ac66146
Rollup merge of #54136 - cuviper:global-isel-dbg.declare, r=alexcrichton
kennytm Sep 12, 2018
1fed251
Rollup merge of #54142 - pnkfelix:fix-regression-test-for-16278, r=we…
kennytm Sep 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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ you have a more recent version installed the build system doesn't understand
then you may need to force rustbuild to use an older version. This can be done
by manually calling the appropriate vcvars file before running the bootstrap.

```
CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
python x.py build
```batch
> CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
> python x.py build
```

#### Specifying an ABI
Expand Down
18 changes: 9 additions & 9 deletions src/bootstrap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ system.

The rustbuild build system has a primary entry point, a top level `x.py` script:

```
python ./x.py build
```sh
$ python ./x.py build
```

Note that if you're on Unix you should be able to execute the script directly:

```
./x.py build
```sh
$ ./x.py build
```

The script accepts commands, flags, and arguments to determine what to do:
Expand Down Expand Up @@ -129,18 +129,18 @@ To follow this course of action, first thing you will want to do is to
install a nightly, presumably using `rustup`. You will then want to
configure your directory to use this build, like so:

```
```sh
# configure to use local rust instead of downloading a beta.
# `--local-rust-root` is optional here. If elided, we will
# use whatever rustc we find on your PATH.
> ./configure --local-rust-root=~/.cargo/ --enable-local-rebuild
$ ./configure --local-rust-root=~/.cargo/ --enable-local-rebuild
```

After that, you can use the `--incremental` flag to actually do
incremental builds:

```
> ./x.py build --incremental
```sh
$ ./x.py build --incremental
```

The `--incremental` flag will store incremental compilation artifacts
Expand All @@ -159,7 +159,7 @@ will still be using the local nightly as your bootstrap).
This build system houses all output under the `build` directory, which looks
like this:

```
```sh
# Root folder of all output. Everything is scoped underneath here
build/

Expand Down
2 changes: 1 addition & 1 deletion src/doc/rustc/src/lints/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $ cat main.rs
fn main() {
let x = 5;
}
> rustc main.rs
$ rustc main.rs
warning: unused variable: `x`
--> main.rs:2:9
|
Expand Down
15 changes: 9 additions & 6 deletions src/doc/rustc/src/lints/levels.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub fn foo() {

This will produce this warning:

```console
```bash
$ rustc lib.rs --crate-type=lib
warning: unused variable: `x`
--> lib.rs:2:9
Expand All @@ -69,7 +69,7 @@ fn main() {
```

```bash
> rustc main.rs
$ rustc main.rs
error: bitshift exceeds the type's number of bits
--> main.rs:2:13
|
Expand Down Expand Up @@ -129,7 +129,10 @@ warning: missing documentation for a function
|
1 | pub fn foo() {}
| ^^^^^^^^^^^^
> rustc lib.rs --crate-type=lib -D missing-docs
```

```bash
$ rustc lib.rs --crate-type=lib -D missing-docs
error: missing documentation for crate
--> lib.rs:1:1
|
Expand All @@ -150,21 +153,21 @@ error: aborting due to 2 previous errors
You can also pass each flag more than once for changing multiple lints:

```bash
rustc lib.rs --crate-type=lib -D missing-docs -D unused-variables
$ rustc lib.rs --crate-type=lib -D missing-docs -D unused-variables
```

And of course, you can mix these four flags together:

```bash
rustc lib.rs --crate-type=lib -D missing-docs -A unused-variables
$ rustc lib.rs --crate-type=lib -D missing-docs -A unused-variables
```

### Via an attribute

You can also modify the lint level with a crate-wide attribute:

```bash
> cat lib.rs
$ cat lib.rs
#![warn(missing_docs)]

pub fn foo() {}
Expand Down
3 changes: 3 additions & 0 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ nonzero_integers! {
/// all standard arithmetic operations on the underlying value are
/// intended to have wrapping semantics.
///
/// The underlying value can be retrieved through the `.0` index of the
/// `Wrapping` tuple.
///
/// # Examples
///
/// ```
Expand Down
30 changes: 30 additions & 0 deletions src/libcore/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,36 @@ impl<T, E> Result<T, E> {
}
}

/// Maps a `Result<T, E>` to `U` by applying a function to a
/// contained [`Ok`] value, or a fallback function to a
/// contained [`Err`] value.
///
/// This function can be used to unpack a successful result
/// while handling an error.
///
/// [`Ok`]: enum.Result.html#variant.Ok
/// [`Err`]: enum.Result.html#variant.Err
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// #![feature(result_map_or_else)]
/// let k = 21;
///
/// let x : Result<_, &str> = Ok("foo");
/// assert_eq!(x.map_or_else(|e| k * 2, |v| v.len()), 3);
///
/// let x : Result<&str, _> = Err("bar");
/// assert_eq!(x.map_or_else(|e| k * 2, |v| v.len()), 42);
/// ```
#[inline]
#[unstable(feature = "result_map_or_else", issue = "53268")]
pub fn map_or_else<U, M: FnOnce(T) -> U, F: FnOnce(E) -> U>(self, fallback: F, map: M) -> U {
self.map(map).unwrap_or_else(fallback)
}

/// Maps a `Result<T, E>` to `Result<T, F>` by applying a function to a
/// contained [`Err`] value, leaving an [`Ok`] value untouched.
///
Expand Down
7 changes: 0 additions & 7 deletions src/libproc_macro/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
//! function-like macros `#[proc_macro]`, macro attributes `#[proc_macro_attribute]` and
//! custom derive attributes`#[proc_macro_derive]`.
//!
//! Note that this crate is intentionally bare-bones currently.
//! This functionality is intended to be expanded over time as more surface
//! area for macro authors is stabilized.
//!
//! See [the book](../book/first-edition/procedural-macros.html) for more.

#![stable(feature = "proc_macro_lib", since = "1.15.0")]
Expand Down Expand Up @@ -73,9 +69,6 @@ use syntax_pos::{Pos, FileName};
///
/// This is both the input and output of `#[proc_macro]`, `#[proc_macro_attribute]`
/// and `#[proc_macro_derive]` definitions.
///
/// The API of this type is intentionally bare-bones, but it'll be expanded over
/// time!
#[stable(feature = "proc_macro_lib", since = "1.15.0")]
#[derive(Clone)]
pub struct TokenStream(tokenstream::TokenStream);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/lint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ use ty::query::Providers;
use util::nodemap::NodeMap;

pub use lint::context::{LateContext, EarlyContext, LintContext, LintStore,
check_crate, check_ast_crate,
check_crate, check_ast_crate, CheckLintNameResult,
FutureIncompatibleInfo, BufferedEarlyLint};

/// Specification of a single lint.
Expand Down
14 changes: 2 additions & 12 deletions src/librustc/ty/subst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const TAG_MASK: usize = 0b11;
const TYPE_TAG: usize = 0b00;
const REGION_TAG: usize = 0b01;

#[derive(Debug, RustcEncodable, RustcDecodable)]
#[derive(Debug, RustcEncodable, RustcDecodable, PartialEq, Eq, PartialOrd, Ord)]
pub enum UnpackedKind<'tcx> {
Lifetime(ty::Region<'tcx>),
Type(Ty<'tcx>),
Expand Down Expand Up @@ -74,17 +74,7 @@ impl<'tcx> UnpackedKind<'tcx> {

impl<'tcx> Ord for Kind<'tcx> {
fn cmp(&self, other: &Kind) -> Ordering {
match (self.unpack(), other.unpack()) {
(UnpackedKind::Type(_), UnpackedKind::Lifetime(_)) => Ordering::Greater,

(UnpackedKind::Type(ty1), UnpackedKind::Type(ty2)) => {
ty1.sty.cmp(&ty2.sty)
}

(UnpackedKind::Lifetime(reg1), UnpackedKind::Lifetime(reg2)) => reg1.cmp(reg2),

(UnpackedKind::Lifetime(_), UnpackedKind::Type(_)) => Ordering::Less,
}
self.unpack().cmp(&other.unpack())
}
}

Expand Down
11 changes: 8 additions & 3 deletions src/librustc_codegen_llvm/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use rustc::hir::def_id::{DefId, LOCAL_CRATE};
use rustc::session::Session;
use rustc::session::config::Sanitizer;
use rustc::ty::TyCtxt;
use rustc::ty::layout::HasTyCtxt;
use rustc::ty::query::Providers;
use rustc_data_structures::sync::Lrc;
use rustc_data_structures::fx::FxHashMap;
Expand All @@ -32,12 +33,16 @@ use value::Value;

/// Mark LLVM function to use provided inline heuristic.
#[inline]
pub fn inline(val: &'ll Value, inline: InlineAttr) {
pub fn inline(cx: &CodegenCx<'ll, '_>, val: &'ll Value, inline: InlineAttr) {
use self::InlineAttr::*;
match inline {
Hint => Attribute::InlineHint.apply_llfn(Function, val),
Always => Attribute::AlwaysInline.apply_llfn(Function, val),
Never => Attribute::NoInline.apply_llfn(Function, val),
Never => {
if cx.tcx().sess.target.target.arch != "amdgpu" {
Attribute::NoInline.apply_llfn(Function, val);
}
},
None => {
Attribute::InlineHint.unapply_llfn(Function, val);
Attribute::AlwaysInline.unapply_llfn(Function, val);
Expand Down Expand Up @@ -143,7 +148,7 @@ pub fn from_fn_attrs(
let codegen_fn_attrs = id.map(|id| cx.tcx.codegen_fn_attrs(id))
.unwrap_or(CodegenFnAttrs::new());

inline(llfn, codegen_fn_attrs.inline);
inline(cx, llfn, codegen_fn_attrs.inline);

// The `uwtable` attribute according to LLVM is:
//
Expand Down
8 changes: 8 additions & 0 deletions src/librustc_codegen_llvm/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,14 @@ impl Builder<'a, 'll, 'tcx> {


pub fn range_metadata(&self, load: &'ll Value, range: Range<u128>) {
if self.sess().target.target.arch == "amdgpu" {
// amdgpu/LLVM does something weird and thinks a i64 value is
// split into a v2i32, halving the bitwidth LLVM expects,
// tripping an assertion. So, for now, just disable this
// optimization.
return;
}

unsafe {
let llty = val_ty(load);
let v = [
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_llvm/callee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pub fn get_fn(
debug!("get_fn: not casting pointer!");

if instance.def.is_inline(tcx) {
attributes::inline(llfn, attributes::InlineAttr::Hint);
attributes::inline(cx, llfn, attributes::InlineAttr::Hint);
}
attributes::from_fn_attrs(cx, llfn, Some(instance.def.def_id()));

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_llvm/mono_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ fn predefine_fn<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,

debug!("predefine_fn: mono_ty = {:?} instance = {:?}", mono_ty, instance);
if instance.def.is_inline(cx.tcx) {
attributes::inline(lldecl, attributes::InlineAttr::Hint);
attributes::inline(cx, lldecl, attributes::InlineAttr::Hint);
}
attributes::from_fn_attrs(cx, lldecl, Some(instance.def.def_id()));

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_llvm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ fn main() {
let is_crossed = target != host;

let mut optional_components =
vec!["x86", "arm", "aarch64", "mips", "powerpc",
vec!["x86", "arm", "aarch64", "amdgpu", "mips", "powerpc",
"systemz", "jsbackend", "webassembly", "msp430", "sparc", "nvptx"];

let mut version_cmd = Command::new(&llvm_config);
Expand Down
Loading