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 17 pull requests #73924

Merged
merged 52 commits into from
Jul 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
46bfc48
Added proper explanation of ErrorCode-E0687
Polkaverse May 10, 2020
1d0378c
impl From<char> for String
matthiaskrgr Jun 17, 2020
2cde493
add test for char into string
matthiaskrgr Jun 18, 2020
886f81e
Fix sentence structure
Anirban166 Jun 23, 2020
0c88dd6
Update Box::from_raw example to generalize better
Keno Jun 24, 2020
3b5d7f8
Minor correction to sentence structure
Anirban166 Jun 24, 2020
d6cf8fc
Update README.md
Anirban166 Jun 24, 2020
2bbc2b3
Document the static keyword
poliorcetics Jun 25, 2020
22fc18f
Commit suggestion
Anirban166 Jun 25, 2020
8edcc6d
Add alternate text for rust logo image
Anirban166 Jun 25, 2020
3a1ac28
Added clickable-link
Anirban166 Jun 25, 2020
4c33b7c
Add responsiveness to logo
Anirban166 Jun 25, 2020
00ef461
Merge pull request #2 from rust-lang/master
TyPR124 Jun 26, 2020
b71a3e1
Map ERROR_INVALID_PARAMETER to InvalidInput
TyPR124 Jun 26, 2020
15e81be
moves terminator types to sub module
aszenz Jun 26, 2020
cf398a3
removes unnecessary tidy ignore
aszenz Jun 26, 2020
224bc05
Fix allow_internal_unstable with rustc_const_unstable
nbdd0121 Jun 26, 2020
fc239e8
Make `likely` and `unlikely` const
nbdd0121 Jun 26, 2020
779b05d
Fix ICE for lib features
nbdd0121 Jun 26, 2020
3fc5593
Document the type keyword
poliorcetics Jun 27, 2020
8b43012
Update src/librustc_mir/interpret/intrinsics.rs
nbdd0121 Jun 27, 2020
517d361
Use an 'approximate' universal upper bound when reporting region errors
Aaron1011 Jun 27, 2020
7231e57
Fix wording for anonymous parameter name help
nop Jun 28, 2020
4595fa8
Fix comma in debug_assert! docs
pierwill Jun 28, 2020
e611a3f
Apply suggestions from code review
poliorcetics Jun 28, 2020
dfd454b
Apply suggestions, reformulating some paragraphs and improving some e…
poliorcetics Jun 28, 2020
4224313
Fix small nits
poliorcetics Jun 28, 2020
40c74a7
Edit cursor.prev() method docs in lexer
pierwill Jun 28, 2020
1d7ba5f
stop taking references in Relate
lcnr Jun 24, 2020
71b45b9
change `skip_binder` to use T by value
lcnr Jun 24, 2020
f632bd1
remove unused `TypeError::ProjectionBoundsLength`
lcnr Jun 24, 2020
69e4990
update `equal_up_to_regions`
lcnr Jun 30, 2020
f3645ca
remove rustdoc warnings
tshepang Jun 30, 2020
3ab7ae3
Bring net/parser.rs up to modern up to date with modern rust patterns
Lucretiel May 20, 2020
f07d10d
Stabilize `#[track_caller]`.
anp May 21, 2020
128fa2b
Rollup merge of #72071 - PankajChaudhary5:ErrorCode-E0687, r=davidtwco
Manishearth Jul 1, 2020
33f8ce2
Rollup merge of #72369 - Lucretiel:socketaddr-parse, r=dtolnay
Manishearth Jul 1, 2020
ae79c30
Rollup merge of #72445 - anp:stabilize-track-caller, r=oli-obk
Manishearth Jul 1, 2020
b7d13c0
Rollup merge of #73466 - matthiaskrgr:char_into_string, r=dtolnay
Manishearth Jul 1, 2020
39209ac
Rollup merge of #73548 - tshepang:fix-rustdoc-warnings, r=ecstatic-morse
Manishearth Jul 1, 2020
0eb9799
Rollup merge of #73649 - Anirban166:patch-1, r=steveklabnik
Manishearth Jul 1, 2020
6556f26
Rollup merge of #73678 - Keno:patch-1, r=LukasKalbertodt
Manishearth Jul 1, 2020
9c65486
Rollup merge of #73705 - lcnr:skip_binder, r=nikomatsakis
Manishearth Jul 1, 2020
8ac17d1
Rollup merge of #73716 - poliorcetics:static-keyword, r=LukasKalbertodt
Manishearth Jul 1, 2020
3951a98
Rollup merge of #73752 - TyPR124:invalid-parameter-error, r=LukasKalb…
Manishearth Jul 1, 2020
d6bee55
Rollup merge of #73776 - aszenz:refactor_mir_module, r=wesleywiser
Manishearth Jul 1, 2020
ec41d01
Rollup merge of #73778 - nbdd0121:const_likely, r=oli-obk
Manishearth Jul 1, 2020
178b0c2
Rollup merge of #73805 - poliorcetics:type-keyword, r=kennytm
Manishearth Jul 1, 2020
f213957
Rollup merge of #73806 - Aaron1011:feature/approx-universal-upper, r=…
Manishearth Jul 1, 2020
db900d4
Rollup merge of #73828 - nop:fix/parameter-name-help, r=estebank
Manishearth Jul 1, 2020
affd950
Rollup merge of #73846 - pierwill:pierwill-patch-2, r=joshtriplett
Manishearth Jul 1, 2020
c9b3e86
Rollup merge of #73847 - pierwill:pierwill-cursor-doc, r=matthewjasper
Manishearth Jul 1, 2020
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
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# The Rust Programming Language
<a href = "https://www.rust-lang.org/">
<img width = "90%" height = "auto" src = "https://img.shields.io/badge/Rust-Programming%20Language-black?style=flat&logo=rust" alt = "The Rust Programming Language">
</a>

This is the main source code repository for [Rust]. It contains the compiler,
standard library, and documentation.
standard library, and documentation.

[Rust]: https://www.rust-lang.org

Expand All @@ -17,9 +19,9 @@ Read ["Installation"] from [The Book].
_Note: If you wish to contribute to the compiler, you should read [this
chapter][rustcguidebuild] of the rustc-dev-guide instead of this section._

The Rust build system has a Python script called `x.py` to bootstrap building
the compiler. More information about it may be found by running `./x.py --help`
or reading the [rustc dev guide][rustcguidebuild].
The Rust build system uses a Python script called `x.py` to build the compiler,
which manages the bootstrapping process. More information about it can be found
by running `./x.py --help` or reading the [rustc dev guide][rustcguidebuild].

[rustcguidebuild]: https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html

Expand Down Expand Up @@ -54,9 +56,8 @@ or reading the [rustc dev guide][rustcguidebuild].
$ cp config.toml.example config.toml
```

It is recommended that if you plan to use the Rust build system to create
an installation (using `./x.py install`) that you set the `prefix` value
in the `[install]` section to a directory that you have write permissions.
If you plan to use `x.py install` to create an installation, it is recommended
that you set the `prefix` value in the `[install]` section to a directory.

Create install directory if you are not installing in default directory

Expand Down Expand Up @@ -143,8 +144,8 @@ shell with:
```

Currently, building Rust only works with some known versions of Visual Studio. If
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
you have a more recent version installed and the build system doesn't understand,
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.

```batch
Expand Down
5 changes: 0 additions & 5 deletions src/doc/unstable-book/src/language-features/track-caller.md

This file was deleted.

5 changes: 4 additions & 1 deletion src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,10 @@ impl<T: ?Sized> Box<T> {
///
/// unsafe {
/// let ptr = alloc(Layout::new::<i32>()) as *mut i32;
/// *ptr = 5;
/// // In general .write is required to avoid attempting to destruct
/// // the (uninitialized) previous contents of `ptr`, though for this
/// // simple example `*ptr = 5` would have worked as well.
/// ptr.write(5);
/// let x = Box::from_raw(ptr);
/// }
/// ```
Expand Down
8 changes: 8 additions & 0 deletions src/liballoc/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2518,3 +2518,11 @@ impl DoubleEndedIterator for Drain<'_> {

#[stable(feature = "fused", since = "1.26.0")]
impl FusedIterator for Drain<'_> {}

#[stable(feature = "from_char_for_string", since = "1.46.0")]
impl From<char> for String {
#[inline]
fn from(c: char) -> Self {
c.to_string()
}
}
7 changes: 7 additions & 0 deletions src/liballoc/tests/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -714,3 +714,10 @@ fn test_try_reserve_exact() {
}
}
}

#[test]
fn test_from_char() {
assert_eq!(String::from('a'), 'a'.to_string());
let s: String = 'x'.into();
assert_eq!(s, 'x'.to_string());
}
2 changes: 2 additions & 0 deletions src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,7 @@ extern "rust-intrinsic" {
/// Any use other than with `if` statements will probably not have an effect.
///
/// This intrinsic does not have a stable counterpart.
#[rustc_const_unstable(feature = "const_likely", issue = "none")]
pub fn likely(b: bool) -> bool;

/// Hints to the compiler that branch condition is likely to be false.
Expand All @@ -960,6 +961,7 @@ extern "rust-intrinsic" {
/// Any use other than with `if` statements will probably not have an effect.
///
/// This intrinsic does not have a stable counterpart.
#[rustc_const_unstable(feature = "const_likely", issue = "none")]
pub fn unlikely(b: bool) -> bool;

/// Executes a breakpoint trap, for inspection by a debugger.
Expand Down
3 changes: 2 additions & 1 deletion src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
#![feature(const_slice_from_raw_parts)]
#![feature(const_slice_ptr_len)]
#![feature(const_type_name)]
#![feature(const_likely)]
#![feature(custom_inner_attributes)]
#![feature(decl_macro)]
#![feature(doc_cfg)]
Expand All @@ -118,7 +119,7 @@
#![feature(staged_api)]
#![feature(std_internals)]
#![feature(stmt_expr_attributes)]
#![feature(track_caller)]
#![cfg_attr(bootstrap, feature(track_caller))]
#![feature(transparent_unions)]
#![feature(unboxed_closures)]
#![feature(unsized_locals)]
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/macros/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#[doc(include = "panic.md")]
#[macro_export]
#[allow_internal_unstable(core_panic, track_caller)]
#[allow_internal_unstable(core_panic, const_caller_location)]
#[stable(feature = "core", since = "1.6.0")]
macro_rules! panic {
() => (
Expand Down Expand Up @@ -151,7 +151,7 @@ macro_rules! assert_ne {
/// An unchecked assertion allows a program in an inconsistent state to keep
/// running, which might have unexpected consequences but does not introduce
/// unsafety as long as this only happens in safe code. The performance cost
/// of assertions, is however, not measurable in general. Replacing [`assert!`]
/// of assertions, however, is not measurable in general. Replacing [`assert!`]
/// with `debug_assert!` is thus only encouraged after thorough profiling, and
/// more importantly, only in safe code!
///
Expand Down
14 changes: 4 additions & 10 deletions src/libcore/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ impl<'a> Location<'a> {
/// # Examples
///
/// ```
/// #![feature(track_caller)]
/// use core::panic::Location;
///
/// /// Returns the [`Location`] at which it is called.
Expand All @@ -206,7 +205,7 @@ impl<'a> Location<'a> {
///
/// let fixed_location = get_just_one_location();
/// assert_eq!(fixed_location.file(), file!());
/// assert_eq!(fixed_location.line(), 15);
/// assert_eq!(fixed_location.line(), 14);
/// assert_eq!(fixed_location.column(), 5);
///
/// // running the same untracked function in a different location gives us the same result
Expand All @@ -217,7 +216,7 @@ impl<'a> Location<'a> {
///
/// let this_location = get_caller_location();
/// assert_eq!(this_location.file(), file!());
/// assert_eq!(this_location.line(), 29);
/// assert_eq!(this_location.line(), 28);
/// assert_eq!(this_location.column(), 21);
///
/// // running the tracked function in a different location produces a different value
Expand All @@ -226,13 +225,8 @@ impl<'a> Location<'a> {
/// assert_ne!(this_location.line(), another_location.line());
/// assert_ne!(this_location.column(), another_location.column());
/// ```
// FIXME: When stabilizing this method, please also update the documentation
// of `intrinsics::caller_location`.
#[unstable(
feature = "track_caller",
reason = "uses #[track_caller] which is not yet stable",
issue = "47809"
)]
#[stable(feature = "track_caller", since = "1.46.0")]
#[rustc_const_unstable(feature = "const_caller_location", issue = "47809")]
#[track_caller]
pub const fn caller() -> &'static Location<'static> {
crate::intrinsics::caller_location()
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_error_codes/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ E0668: include_str!("./error_codes/E0668.md"),
E0669: include_str!("./error_codes/E0669.md"),
E0670: include_str!("./error_codes/E0670.md"),
E0671: include_str!("./error_codes/E0671.md"),
E0687: include_str!("./error_codes/E0687.md"),
E0689: include_str!("./error_codes/E0689.md"),
E0690: include_str!("./error_codes/E0690.md"),
E0691: include_str!("./error_codes/E0691.md"),
Expand Down Expand Up @@ -613,7 +614,6 @@ E0766: include_str!("./error_codes/E0766.md"),
E0640, // infer outlives requirements
// E0645, // trait aliases not finished
E0667, // `impl Trait` in projections
E0687, // in-band lifetimes cannot be used in `fn`/`Fn` syntax
E0688, // in-band lifetimes cannot be mixed with explicit lifetime binders
// E0694, // an unknown tool name found in scoped attributes
// E0702, // replaced with a generic attribute input check
Expand Down
36 changes: 36 additions & 0 deletions src/librustc_error_codes/error_codes/E0687.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
In-band lifetimes cannot be used in `fn`/`Fn` syntax.

Erroneous code examples:

```compile_fail,E0687
#![feature(in_band_lifetimes)]

fn foo(x: fn(&'a u32)) {} // error!

fn bar(x: &Fn(&'a u32)) {} // error!

fn baz(x: fn(&'a u32), y: &'a u32) {} // error!

struct Foo<'a> { x: &'a u32 }

impl Foo<'a> {
fn bar(&self, x: fn(&'a u32)) {} // error!
}
```

Lifetimes used in `fn` or `Fn` syntax must be explicitly
declared using `<...>` binders. For example:

```
fn foo<'a>(x: fn(&'a u32)) {} // ok!

fn bar<'a>(x: &Fn(&'a u32)) {} // ok!

fn baz<'a>(x: fn(&'a u32), y: &'a u32) {} // ok!

struct Foo<'a> { x: &'a u32 }

impl<'a> Foo<'a> {
fn bar(&self, x: fn(&'a u32)) {} // ok!
}
```
2 changes: 0 additions & 2 deletions src/librustc_error_codes/error_codes/E0736.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
Erroneous code example:

```compile_fail,E0736
#![feature(track_caller)]

#[naked]
#[track_caller]
fn foo() {}
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_error_codes/error_codes/E0737.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ restrictions.
Erroneous code example:

```compile_fail,E0737
#![feature(track_caller)]

#[track_caller]
extern "C" fn foo() {}
```
Expand Down
1 change: 0 additions & 1 deletion src/librustc_error_codes/error_codes/E0739.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
Erroneous code example:

```compile_fail,E0739
#![feature(track_caller)]
#[track_caller]
struct Bar {
a: u8,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_errors/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
#![feature(crate_visibility_modifier)]
#![feature(nll)]
#![feature(track_caller)]
#![cfg_attr(bootstrap, feature(track_caller))]

pub use emitter::ColorConfig;

Expand Down
3 changes: 3 additions & 0 deletions src/librustc_feature/accepted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ declare_features! (
(accepted, const_if_match, "1.45.0", Some(49146), None),
/// Allows the use of `loop` and `while` in constants.
(accepted, const_loop, "1.45.0", Some(52000), None),
/// Allows `#[track_caller]` to be used which provides
/// accurate caller location reporting during panic (RFC 2091).
(accepted, track_caller, "1.46.0", Some(47809), None),

// -------------------------------------------------------------------------
// feature-group-end: accepted features
Expand Down
4 changes: 0 additions & 4 deletions src/librustc_feature/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,6 @@ declare_features! (
/// Allows the use of raw-dylibs (RFC 2627).
(active, raw_dylib, "1.40.0", Some(58713), None),

/// Allows `#[track_caller]` to be used which provides
/// accurate caller location reporting during panic (RFC 2091).
(active, track_caller, "1.40.0", Some(47809), None),

/// Allows making `dyn Trait` well-formed even if `Trait` is not object safe.
/// In that case, `dyn Trait: Trait` does not hold. Moreover, coercions and
/// casts in safe Rust to `dyn Trait` for such a `Trait` is also forbidden.
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_feature/builtin_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
ungated!(cold, Whitelisted, template!(Word)),
ungated!(no_builtins, Whitelisted, template!(Word)),
ungated!(target_feature, Whitelisted, template!(List: r#"enable = "name""#)),
ungated!(track_caller, Whitelisted, template!(Word)),
gated!(
no_sanitize, Whitelisted,
template!(List: "address, memory, thread"),
Expand Down Expand Up @@ -333,7 +334,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
gated!(ffi_returns_twice, Whitelisted, template!(Word), experimental!(ffi_returns_twice)),
gated!(ffi_pure, Whitelisted, template!(Word), experimental!(ffi_pure)),
gated!(ffi_const, Whitelisted, template!(Word), experimental!(ffi_const)),
gated!(track_caller, Whitelisted, template!(Word), experimental!(track_caller)),
gated!(
register_attr, CrateLevel, template!(List: "attr1, attr2, ..."),
experimental!(register_attr),
Expand Down
18 changes: 9 additions & 9 deletions src/librustc_infer/infer/at.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl<'a, 'tcx> At<'a, 'tcx> {
where
T: ToTrace<'tcx>,
{
self.trace_exp(a_is_expected, a, b).sub(&a, &b)
self.trace_exp(a_is_expected, a, b).sub(a, b)
}

/// Makes `actual <: expected`. For example, if type-checking a
Expand All @@ -109,15 +109,15 @@ impl<'a, 'tcx> At<'a, 'tcx> {
where
T: ToTrace<'tcx>,
{
self.trace_exp(a_is_expected, a, b).eq(&a, &b)
self.trace_exp(a_is_expected, a, b).eq(a, b)
}

/// Makes `expected <: actual`.
pub fn eq<T>(self, expected: T, actual: T) -> InferResult<'tcx, ()>
where
T: ToTrace<'tcx>,
{
self.trace(expected, actual).eq(&expected, &actual)
self.trace(expected, actual).eq(expected, actual)
}

pub fn relate<T>(self, expected: T, variance: ty::Variance, actual: T) -> InferResult<'tcx, ()>
Expand Down Expand Up @@ -147,7 +147,7 @@ impl<'a, 'tcx> At<'a, 'tcx> {
where
T: ToTrace<'tcx>,
{
self.trace(expected, actual).lub(&expected, &actual)
self.trace(expected, actual).lub(expected, actual)
}

/// Computes the greatest-lower-bound, or mutual subtype, of two
Expand All @@ -157,7 +157,7 @@ impl<'a, 'tcx> At<'a, 'tcx> {
where
T: ToTrace<'tcx>,
{
self.trace(expected, actual).glb(&expected, &actual)
self.trace(expected, actual).glb(expected, actual)
}

/// Sets the "trace" values that will be used for
Expand Down Expand Up @@ -186,7 +186,7 @@ impl<'a, 'tcx> At<'a, 'tcx> {
impl<'a, 'tcx> Trace<'a, 'tcx> {
/// Makes `a <: b` where `a` may or may not be expected (if
/// `a_is_expected` is true, then `a` is expected).
pub fn sub<T>(self, a: &T, b: &T) -> InferResult<'tcx, ()>
pub fn sub<T>(self, a: T, b: T) -> InferResult<'tcx, ()>
where
T: Relate<'tcx>,
{
Expand All @@ -203,7 +203,7 @@ impl<'a, 'tcx> Trace<'a, 'tcx> {

/// Makes `a == b`; the expectation is set by the call to
/// `trace()`.
pub fn eq<T>(self, a: &T, b: &T) -> InferResult<'tcx, ()>
pub fn eq<T>(self, a: T, b: T) -> InferResult<'tcx, ()>
where
T: Relate<'tcx>,
{
Expand All @@ -218,7 +218,7 @@ impl<'a, 'tcx> Trace<'a, 'tcx> {
})
}

pub fn lub<T>(self, a: &T, b: &T) -> InferResult<'tcx, T>
pub fn lub<T>(self, a: T, b: T) -> InferResult<'tcx, T>
where
T: Relate<'tcx>,
{
Expand All @@ -233,7 +233,7 @@ impl<'a, 'tcx> Trace<'a, 'tcx> {
})
}

pub fn glb<T>(self, a: &T, b: &T) -> InferResult<'tcx, T>
pub fn glb<T>(self, a: T, b: T) -> InferResult<'tcx, T>
where
T: Relate<'tcx>,
{
Expand Down
Loading