Skip to content

Fix all non-bug lints. Switch to let statements. #56956

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

Closed
wants to merge 124 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
124 commits
Select commit Hold shift + click to select a range
9691ad0
Fix all non-bug lints
JohnHeitmann Dec 28, 2018
2878ab8
Use let instead of var, except for globals.
JohnHeitmann Dec 18, 2018
8c304d3
Clean up eslint pragma formatting
JohnHeitmann Jan 2, 2019
aa429bd
Use checked_add for adding time in recv_timeout
faern Dec 14, 2018
e1f7cd8
Add documentation about panicking Add<Duration> impls
faern Dec 14, 2018
2f9d3c7
Uninline some debugging code and use unlikely! macro
Zoxc Dec 5, 2018
44ba1e9
Store `Ident` rather than just `Name` in HIR types `Item` and `Foreig…
alexreg Dec 1, 2018
4748dc5
Implemented variants on type aliases in both ctor and pattern position.
alexreg Dec 3, 2018
711af86
Added tests for feature.
alexreg Dec 3, 2018
9fcbf24
Made suggestion diagnostics more consistent for enum variant names, r…
alexreg Dec 3, 2018
4137376
Fixed tests.
alexreg Dec 6, 2018
c85edb8
Fixed more tests.
alexreg Dec 7, 2018
f30d29a
Added chapter to Unstable Book.
alexreg Dec 3, 2018
12b64b6
Fixed issues raised in first review.
alexreg Dec 6, 2018
06b716e
Work-around for shadowing of variant names with assoc const names in …
alexreg Dec 7, 2018
2eeb932
Added tests for enums & enum aliases with various combinations of gen…
alexreg Dec 13, 2018
f370436
Fixed issues raised in review.
alexreg Dec 15, 2018
f74f949
Expanded tests for enum variants with generic args.
alexreg Dec 15, 2018
8b6769c
Removed unnecessary special handling of `VariantCtor` defs in `instan…
alexreg Dec 15, 2018
72d498d
Fixed several ICEs.
alexreg Dec 17, 2018
89a33dd
Added regression test for using generic parameters on modules.
alexreg Dec 18, 2018
f79535b
Fixed handling of unit variants of aliased enums in type NS.
alexreg Dec 18, 2018
8fec007
Fixed type inference for tuple struct variants.
alexreg Dec 20, 2018
0f3f0b8
Fixed ICE when type arguments are specified on `Self` type.
alexreg Dec 20, 2018
66ee7c4
Minor clean-up
alexreg Dec 26, 2018
2445f43
Minor cosmetic changes
alexreg Dec 26, 2018
92e3a35
Changed resolution of enum variants to low priority.
alexreg Dec 26, 2018
21a012a
Point at correct span for arguments in format strings
estebank Dec 27, 2018
936ea70
Add span label to unused string formatting argument
estebank Dec 27, 2018
acb04c1
retrieve ty info from place_ty
csmoe Dec 27, 2018
fa563d5
Fix typo in pin documentation
sgrif Dec 27, 2018
65819ce
Fix span in char documentation
estebank Dec 27, 2018
efd19d5
Update references to closed issue
ids1024 Dec 28, 2018
3751654
resolve: Fix an ICE in import validation
petrochenkov Dec 28, 2018
b4d18a2
Give the crate select chevron room to breathe.
JohnHeitmann Dec 28, 2018
2cb1ece
Removed aligned ZST requirement from docs of read_/write_unaligned.
kennytm Dec 28, 2018
6a3d95e
Update link to rustc guide
linclark Dec 28, 2018
00ef955
Suggest `.as_ref()` when appropriate for `Option` and `Result`
estebank Dec 28, 2018
e3db7ee
Clarify wording of E0512
varkor Dec 21, 2018
9e15f42
Add specific diagnostic for transmuting between equal associated types
varkor Dec 21, 2018
c7e83ba
Fix warning when compiling rustc
varkor Dec 28, 2018
07f6432
remove remaining copyright headers
matthiaskrgr Dec 28, 2018
2c3d194
resolve: Fix another ICE in import validation
petrochenkov Dec 28, 2018
42730aa
resolve: Never override real bindings with `Def::Err`s from error rec…
petrochenkov Dec 28, 2018
7848878
Update cargo, rls, miri
ehuss Dec 17, 2018
2b7ff35
add non-copy note to stderr
csmoe Dec 27, 2018
9b9fd03
Fixed stderr files for ui tests.
alexreg Dec 29, 2018
c1bea3b
update tests line numbers
matthiaskrgr Dec 29, 2018
643e4e6
resolve: Simplify treatment of ambiguity errors
petrochenkov Dec 29, 2018
f5f5d4c
Use `same_type` instead of duplicating logic
estebank Dec 29, 2018
87a4d21
Remove mention of required memory to build
nagisa Dec 29, 2018
111bcb1
Improve error recovery for some built-in macros
petrochenkov Dec 29, 2018
a5b93f0
Make std::cmp::Ord documentation specify what it means to agree with …
czipperz Dec 29, 2018
6090b31
Specify criterion for PartialOrd
czipperz Dec 30, 2018
faaae93
Mention ToString in std::fmt docs
czipperz Dec 29, 2018
c22ee1a
Do not complain about missing crate named as a keyword
estebank Dec 30, 2018
cceb1f7
Refactor `UserTypeAnnotation`.
davidtwco Nov 16, 2018
43538cb
Always check well-formedness.
davidtwco Nov 22, 2018
7fc1fee
Add test for unreachable well-formedness.
davidtwco Nov 23, 2018
1681b2d
Type annotations in associated constant patterns.
davidtwco Nov 24, 2018
70ffd8d
Add user type annotations to MIR dump.
davidtwco Nov 25, 2018
5e75340
Support user type annotations in `ref` bindings.
davidtwco Nov 25, 2018
3507013
Add explicit error annotations to test.
davidtwco Dec 7, 2018
ae43eec
Fix unresolved inference variable ICE.
davidtwco Dec 9, 2018
ac18fbb
Stop well-formedness checking unreachable code.
davidtwco Dec 18, 2018
ab2a785
Stop duplicating projections of type annotation.
davidtwco Dec 19, 2018
5d760c0
Guarantee `rustc_dump_user_substs` error order.
davidtwco Dec 22, 2018
2a7cc8e
submodules: update clippy from f7bdf500 to 39bd8449
matthiaskrgr Dec 30, 2018
0012941
Add `-Z instrument-mcount`
quark-zju Dec 30, 2018
5345ae9
Address review comments: Remove new `PathResult` variant
estebank Dec 30, 2018
9f0925d
Fix variable string size problem in transmute test
varkor Dec 30, 2018
1ea7f96
Group dep node data into a single structure
Zoxc Dec 22, 2018
c5cba54
Use `entry` API to avoid double lookup when interning dep nodes
Zoxc Dec 23, 2018
216e8cc
Address comments
Zoxc Dec 31, 2018
21e0948
Fix inconsistent Clone documentation.
doitian Dec 26, 2018
7e454d2
Suggest using raw identifiers in 2018 edition when using keywords
estebank Dec 30, 2018
9ee58ff
Address review comments
estebank Dec 30, 2018
fdedfc0
Update tests after rebase
estebank Dec 31, 2018
7cf4468
Account for `\xFF` and `\u{FF}` sequences in string format errors
estebank Dec 27, 2018
73ba9d8
Use structured suggestion for braceless unicode escape squence
estebank Dec 27, 2018
0ed7ced
use structured suggestions for nonexistent fields
euclio Dec 20, 2018
4b57fea
Do not use unicode character in diagnostic help
estebank Dec 31, 2018
3d0bcd2
privacy: Use common `DefId` visiting infra for all privacy visitors
petrochenkov Dec 16, 2018
e4bab0e
Address review comments
petrochenkov Dec 31, 2018
303e440
Bound sgx target_env with fortanix as target_vendor
dingelish Dec 31, 2018
df9f594
Improve type mismatch error messages
codeworm96 Jan 1, 2019
98d4589
Remove min_const_unsafe_fn since it is stable
dingelish Jan 1, 2019
b25abf1
syntax: Fix regression in diagnostics for patterns in trait method pa…
petrochenkov Jan 1, 2019
454f7cb
generate invalidations from 2-phase-borrow activations
nikomatsakis Dec 4, 2018
4bb9ecd
adopt polonius-engine 0.6.2
nikomatsakis Jan 2, 2019
ce6192c
Wf-check the output type of a function in MIR-typeck
matthewjasper Jan 2, 2019
9c9411a
Add missing 'static bound for the Machine trait
matthewjasper Jan 2, 2019
db29f09
remove `commit_if_ok` wrapper
nikomatsakis Oct 15, 2018
a7ec107
remove wrapper functions that had no purpose
nikomatsakis Oct 15, 2018
89ad572
make evaluation track whether outlives relationships mattered
nikomatsakis Sep 20, 2018
1e89f28
introduce ability to detect region constraints from snapshot
nikomatsakis Oct 16, 2018
9e8fa85
select.rs: unsizing coercion should use a subtype
nikomatsakis Dec 27, 2018
254d1a4
WIP: wfcheck ability to detect
nikomatsakis Dec 27, 2018
b46812b
universe transition
nikomatsakis Sep 8, 2018
8165541
add tests exercising `exists<'a> { forall<'b> { .. } }` pattern
nikomatsakis Oct 30, 2018
1423a67
tests: move coherence-subtyping from run-pass to compile-fail
nikomatsakis Oct 30, 2018
c1cd912
tests: worse diagnostics, but basically same errors
nikomatsakis Oct 30, 2018
a0ccf99
tests: cases where we now do the right thing but did not before
nikomatsakis Dec 31, 2018
581dc66
WIP other test changes
nikomatsakis Dec 31, 2018
616898f
remove outdated `rustc_driver` tests
nikomatsakis Oct 31, 2018
94123f2
make `get_highlight_region_for_regionvid` only affect re-vid
nikomatsakis Nov 17, 2018
d354e85
dump out the exact state in error reporting debugs
nikomatsakis Nov 17, 2018
b412851
generalize region highlights into a struct
nikomatsakis Nov 17, 2018
749b6fb
add the ability to highlight placeholders
nikomatsakis Nov 17, 2018
b53e7e3
introduce placeholder-placeholder errors for trait matching
nikomatsakis Nov 17, 2018
d3a8d6d
apply the new placeholder errors even with just one placeholder
nikomatsakis Nov 18, 2018
3744f87
refactor highlighting to take any RegionKind, making it more general
nikomatsakis Nov 18, 2018
deb0366
apply the same logic to ConcreteFailure errors
nikomatsakis Nov 19, 2018
d4fb139
say "the lifetime" instead of "some lifetime" when it feels right
nikomatsakis Nov 19, 2018
e9ba964
improve handling for subtype
nikomatsakis Nov 19, 2018
6d6f12e
pacify the mercilous tidy
nikomatsakis Nov 19, 2018
57f76be
address tmandry nits
nikomatsakis Nov 19, 2018
a90bd6c
add some comments about lifetimes etc
nikomatsakis Nov 19, 2018
500c093
pacify the mercilous eddyb ;)
nikomatsakis Nov 19, 2018
0c81a2f
track if any region constraints involved placeholders
nikomatsakis Nov 20, 2018
f17caab
try to detect affected code and direct people to #56105
nikomatsakis Nov 20, 2018
96640ad
rename `type_moves_by_default` to `type_is_copy_modulo_regions`
nikomatsakis Nov 20, 2018
0303de6
Add optional eslint to the rustdoc-js test target
JohnHeitmann Jan 5, 2019
1c029f4
Delete buggy code that is probably dead
JohnHeitmann Jan 5, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
131 changes: 65 additions & 66 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ members = [
"src/tools/rustdoc-themes",
]
exclude = [
"src/tools/rls/test_data",
"build",
# HACK(eddyb) This hardcodes the fact that our CI uses `/checkout/obj`.
"obj",
Expand Down
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,18 +186,15 @@ fetch snapshots, and an OS that can execute the available snapshot binaries.

Snapshot binaries are currently built and tested on several platforms:

| Platform / Architecture | x86 | x86_64 |
|--------------------------------|-----|--------|
| Windows (7, 8, Server 2008 R2) | ✓ | ✓ |
| Linux (2.6.18 or later) | ✓ | ✓ |
| OSX (10.7 Lion or later) | ✓ | ✓ |
| Platform / Architecture | x86 | x86_64 |
|--------------------------|-----|--------|
| Windows (7, 8, 10, ...) | ✓ | ✓ |
| Linux (2.6.18 or later) | ✓ | ✓ |
| OSX (10.7 Lion or later) | ✓ | ✓ |

You may find that other platforms work, but these are our officially
supported build environments that are most likely to work.

Rust currently needs between 600MiB and 1.5GiB of RAM to build, depending on platform.
If it hits swap, it will take a very long time to build.

There is more advice about hacking on Rust in [CONTRIBUTING.md].

[CONTRIBUTING.md]: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md
Expand Down
4 changes: 4 additions & 0 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@
# target when running tests, otherwise this can be omitted.
#nodejs = "node"

# The eslint executable to use. Note that this is only used for linting js files
# during the test phase. It can be omitted.
#eslint = "eslint"

# Python interpreter to use for various tasks throughout the build, notably
# rustdoc tests, the lldb python interpreter, and some dist bits and pieces.
# Note that Python 2 is currently required.
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ pub struct Config {
pub libdir: Option<PathBuf>,
pub mandir: Option<PathBuf>,
pub codegen_tests: bool,
pub eslint: Option<PathBuf>,
pub nodejs: Option<PathBuf>,
pub gdb: Option<PathBuf>,
pub python: Option<PathBuf>,
Expand Down Expand Up @@ -202,6 +203,7 @@ struct Build {
gdb: Option<String>,
locked_deps: Option<bool>,
vendor: Option<bool>,
eslint: Option<String>,
nodejs: Option<String>,
python: Option<String>,
full_bootstrap: Option<bool>,
Expand Down Expand Up @@ -444,6 +446,7 @@ impl Config {
};


config.eslint = build.eslint.map(PathBuf::from);
config.nodejs = build.nodejs.map(PathBuf::from);
config.gdb = build.gdb.map(PathBuf::from);
config.python = build.python.map(PathBuf::from);
Expand Down
15 changes: 8 additions & 7 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,6 @@ impl Step for Rls {
SourceType::Submodule,
&[]);

// Copy `src/tools/rls/test_data` to a writable drive.
let test_workspace_path = builder.out.join("rls-test-data");
let test_data_path = test_workspace_path.join("test_data");
builder.create_dir(&test_data_path);
builder.cp_r(&builder.src.join("src/tools/rls/test_data"), &test_data_path);
cargo.env("RLS_TEST_WORKSPACE_DIR", test_workspace_path);

builder.add_rustc_lib_path(compiler, &mut cargo);
cargo.arg("--")
.args(builder.config.cmd.test_args());
Expand Down Expand Up @@ -616,6 +609,14 @@ impl Step for RustdocJS {
"No nodejs found, skipping \"src/test/rustdoc-js\" tests"
);
}

if let Some(ref eslint) = builder.config.eslint {
let mut command = Command::new(eslint);
command.args(&["src/librustdoc/html/static"]);
builder.run(&mut command);
} else {
builder.info("No eslint found, skipping js linting");
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl Step for ToolBuild {
});

if is_expected && !duplicates.is_empty() {
println!("duplicate artfacts found when compiling a tool, this \
println!("duplicate artifacts found when compiling a tool, this \
typically means that something was recompiled because \
a transitive dependency has different features activated \
than in a previous build:\n");
Expand Down
12 changes: 0 additions & 12 deletions src/doc/rust.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
/**
* Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
* file at the top-level directory of this distribution and at
* http://rust-lang.org/COPYRIGHT.
* With elements taken from Bootstrap v3.0.2 (MIT licensed).
*
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
* http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
* <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
* option. This file may not be copied, modified, or distributed
* except according to those terms.
*/
@font-face {
font-family: 'Fira Sans';
font-style: normal;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# `non_ascii_idents`

The tracking issue for this feature is: [#28979]
The tracking issue for this feature is: [#55467]

[#28979]: https://github.com/rust-lang/rust/issues/28979
[#55467]: https://github.com/rust-lang/rust/issues/55467

------------------------

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# `type_alias_enum_variants`

The tracking issue for this feature is: [#49683]

[#49683]: https://github.com/rust-lang/rust/issues/49683

------------------------

The `type_alias_enum_variants` feature enables the use of variants on type
aliases that refer to enums, as both a constructor and a pattern. That is,
it allows for the syntax `EnumAlias::Variant`, which behaves exactly the same
as `Enum::Variant` (assuming that `EnumAlias` is an alias for some enum type
`Enum`).

Note that since `Self` exists as a type alias, this feature also enables the
use of the syntax `Self::Variant` within an impl block for an enum type.

```rust
#![feature(type_alias_enum_variants)]

enum Foo {
Bar(i32),
Baz { i: i32 },
}

type Alias = Foo;

fn main() {
let t = Alias::Bar(0);
let t = Alias::Baz { i: 0 };
match t {
Alias::Bar(_i) => {}
Alias::Baz { i: _i } => {}
}
}
```
4 changes: 4 additions & 0 deletions src/liballoc/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
//! will then parse the format string and determine if the list of arguments
//! provided is suitable to pass to this format string.
//!
//! To convert a single value to a string, use the [`to_string`] method. This
//! will use the [`Display`] formatting trait.
//!
//! ## Positional parameters
//!
//! Each formatting argument is allowed to specify which value argument it's
Expand Down Expand Up @@ -487,6 +490,7 @@
//! [`write!`]: ../../std/macro.write.html
//! [`Debug`]: trait.Debug.html
//! [`format!`]: ../../std/macro.format.html
//! [`to_string`]: ../../std/string/trait.ToString.html
//! [`writeln!`]: ../../std/macro.writeln.html
//! [`write_fmt`]: ../../std/io/trait.Write.html#method.write_fmt
//! [`std::io::Write`]: ../../std/io/trait.Write.html
Expand Down
5 changes: 5 additions & 0 deletions src/liballoc/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,14 @@ macro_rules! vec {
/// The same convention is used with [`print!`] and [`write!`] macros,
/// depending on the intended destination of the string.
///
/// To convert a single value to a string, use the [`to_string`] method. This
/// will use the [`Display`] formatting trait.
///
/// [fmt]: ../std/fmt/index.html
/// [`print!`]: ../std/macro.print.html
/// [`write!`]: ../std/macro.write.html
/// [`to_string`]: ../std/string/trait.ToString.html
/// [`Display`]: ../std/fmt/trait.Display.html
///
/// # Panics
///
Expand Down
29 changes: 20 additions & 9 deletions src/libcore/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,39 @@
/// This trait can be used with `#[derive]` if all fields are `Clone`. The `derive`d
/// implementation of [`clone`] calls [`clone`] on each field.
///
/// For a generic struct, `#[derive]` implements `Clone` conditionally by adding bound `Clone` on
/// generic parameters.
///
/// ```
/// // `derive` implements Clone for Reading<T> when T is Clone.
/// #[derive(Clone)]
/// struct Reading<T> {
/// frequency: T,
/// }
/// ```
///
/// ## How can I implement `Clone`?
///
/// Types that are [`Copy`] should have a trivial implementation of `Clone`. More formally:
/// if `T: Copy`, `x: T`, and `y: &T`, then `let x = y.clone();` is equivalent to `let x = *y;`.
/// Manual implementations should be careful to uphold this invariant; however, unsafe code
/// must not rely on it to ensure memory safety.
///
/// An example is an array holding more than 32 elements of a type that is `Clone`; the standard
/// library only implements `Clone` up until arrays of size 32. In this case, the implementation of
/// `Clone` cannot be `derive`d, but can be implemented as:
/// An example is a generic struct holding a function pointer. In this case, the
/// implementation of `Clone` cannot be `derive`d, but can be implemented as:
///
/// [`Copy`]: ../../std/marker/trait.Copy.html
/// [`clone`]: trait.Clone.html#tymethod.clone
///
/// ```
/// #[derive(Copy)]
/// struct Stats {
/// frequencies: [i32; 100],
/// }
/// struct Generate<T>(fn() -> T);
///
/// impl<T> Copy for Generate<T> {}
///
/// impl Clone for Stats {
/// fn clone(&self) -> Stats { *self }
/// impl<T> Clone for Generate<T> {
/// fn clone(&self) -> Self {
/// *self
/// }
/// }
/// ```
///
Expand Down
8 changes: 5 additions & 3 deletions src/libcore/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,11 @@ impl<T: Ord> Ord for Reverse<T> {
/// Then you must define an implementation for `cmp()`. You may find it useful to use
/// `cmp()` on your type's fields.
///
/// Implementations of `PartialEq`, `PartialOrd`, and `Ord` *must* agree with each other. It's
/// easy to accidentally make them disagree by deriving some of the traits and manually
/// implementing others.
/// Implementations of `PartialEq`, `PartialOrd`, and `Ord` *must*
/// agree with each other. That is, `a.cmp(b) == Ordering::Equal` if
/// and only if `a == b` and `Some(a.cmp(b)) == a.partial_cmp(b)` for
/// all `a` and `b`. It's easy to accidentally make them disagree by
/// deriving some of the traits and manually implementing others.
///
/// Here's an example where you want to sort people by height only, disregarding `id`
/// and `name`:
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/pin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
//! values.
//!
//! However, these restrictions are usually not necessary. Many types are always freely
//! movable. These types implement the [`Unpin`] auto-trait, which nullifies the affect
//! movable. These types implement the [`Unpin`] auto-trait, which nullifies the effect
//! of [`Pin`]. For `T: Unpin`, `Pin<Box<T>>` and `Box<T>` function identically, as do
//! `Pin<&mut T>` and `&mut T`.
//!
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ pub unsafe fn read<T>(src: *const T) -> T {
/// whether `T` is [`Copy`]. If `T` is not [`Copy`], using both the returned
/// value and the value at `*src` can [violate memory safety][read-ownership].
///
/// Note that even if `T` has size `0`, the pointer must be non-NULL and properly aligned.
/// Note that even if `T` has size `0`, the pointer must be non-NULL.
///
/// [`Copy`]: ../marker/trait.Copy.html
/// [`read`]: ./fn.read.html
Expand Down Expand Up @@ -759,7 +759,7 @@ pub unsafe fn write<T>(dst: *mut T, src: T) {
///
/// * `dst` must be [valid] for writes.
///
/// Note that even if `T` has size `0`, the pointer must be non-NULL and properly aligned.
/// Note that even if `T` has size `0`, the pointer must be non-NULL.
///
/// [valid]: ../ptr/index.html#safety
///
Expand Down
7 changes: 3 additions & 4 deletions src/libfmt_macros/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ pub struct Parser<'a> {
/// `Some(raw count)` when the string is "raw", used to position spans correctly
style: Option<usize>,
/// Start and end byte offset of every successfully parsed argument
pub arg_places: Vec<(usize, usize)>,
pub arg_places: Vec<(SpanIndex, SpanIndex)>,
/// Characters that need to be shifted
skips: Vec<usize>,
/// Span offset of the last opening brace seen, used for error reporting
Expand All @@ -154,7 +154,7 @@ pub struct Parser<'a> {
}

#[derive(Clone, Copy, Debug)]
pub struct SpanIndex(usize);
pub struct SpanIndex(pub usize);

impl SpanIndex {
pub fn unwrap(self) -> usize {
Expand All @@ -166,7 +166,6 @@ impl<'a> Iterator for Parser<'a> {
type Item = Piece<'a>;

fn next(&mut self) -> Option<Piece<'a>> {
let raw = self.raw();
if let Some(&(pos, c)) = self.cur.peek() {
match c {
'{' => {
Expand All @@ -180,7 +179,7 @@ impl<'a> Iterator for Parser<'a> {
} else {
let arg = self.argument();
if let Some(arg_pos) = self.must_consume('}').map(|end| {
(pos + raw + 1, end + raw + 2)
(self.to_span_index(pos), self.to_span_index(end + 1))
}) {
self.arg_places.push(arg_pos);
}
Expand Down
3 changes: 2 additions & 1 deletion src/libpanic_abort/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#![panic_runtime]
#![allow(unused_features)]

#![feature(cfg_target_vendor)]
#![feature(core_intrinsics)]
#![feature(libc)]
#![feature(nll)]
Expand Down Expand Up @@ -57,7 +58,7 @@ pub unsafe extern fn __rust_start_panic(_payload: usize) -> u32 {
core::intrinsics::abort();
}

#[cfg(target_env="sgx")]
#[cfg(all(target_vendor="fortanix", target_env="sgx"))]
unsafe fn abort() -> ! {
extern "C" { pub fn panic_exit() -> !; }
panic_exit();
Expand Down
24 changes: 15 additions & 9 deletions src/libproc_macro/bridge/rpc.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Serialization for client<->server communication.
//! Serialization for client-server communication.

use std::any::Any;
use std::char;
Expand Down Expand Up @@ -71,15 +71,18 @@ macro_rules! rpc_encode_decode {
(enum $name:ident $(<$($T:ident),+>)* { $($variant:ident $(($field:ident))*),* $(,)* }) => {
impl<S, $($($T: Encode<S>),+)*> Encode<S> for $name $(<$($T),+>)* {
fn encode(self, w: &mut Writer, s: &mut S) {
// HACK(eddyb) `Tag` enum duplicated between the
// HACK(eddyb): `Tag` enum duplicated between the
// two impls as there's no other place to stash it.
#[repr(u8)] enum Tag { $($variant),* }
#[allow(non_upper_case_globals)]
impl Tag { $(const $variant: u8 = Tag::$variant as u8;)* }
mod tag {
#[repr(u8)] enum Tag { $($variant),* }

$(pub const $variant: u8 = Tag::$variant as u8;)*
}

match self {
$($name::$variant $(($field))* => {
<Tag>::$variant.encode(w, s);
tag::$variant.encode(w, s);
$($field.encode(w, s);)*
})*
}
Expand All @@ -90,14 +93,17 @@ macro_rules! rpc_encode_decode {
for $name $(<$($T),+>)*
{
fn decode(r: &mut Reader<'a>, s: &mut S) -> Self {
// HACK(eddyb) `Tag` enum duplicated between the
// HACK(eddyb): `Tag` enum duplicated between the
// two impls as there's no other place to stash it.
#[repr(u8)] enum Tag { $($variant),* }
#[allow(non_upper_case_globals)]
impl Tag { $(const $variant: u8 = Tag::$variant as u8;)* }
mod tag {
#[repr(u8)] enum Tag { $($variant),* }

$(pub const $variant: u8 = Tag::$variant as u8;)*
}

match u8::decode(r, s) {
$(<Tag>::$variant => {
$(tag::$variant => {
$(let $field = DecodeMut::decode(r, s);)*
$name::$variant $(($field))*
})*
Expand Down
Loading