]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agofn must be const if marked with stability attribut
Lamb [Sat, 3 Jul 2021 10:07:06 +0000 (12:07 +0200)]
fn must be const if marked with stability attribut

remove trailing newline

fix: test with attribute but missing const

Update compiler/rustc_passes/src/stability.rs

Co-authored-by: Léo Lanteri Thauvin <leseulartichaut@gmail.com>
Add test for extern functions

fix: using span_help instead of span_suggestion

add test for some ABIs + fmt fix

Update compiler/rustc_passes/src/stability.rs

Co-authored-by: Léo Lanteri Thauvin <leseulartichaut@gmail.com>
Refractor and add test for `impl const`

Add test to make sure no output + cleanup condition

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

remove stdcall test, failing CI test

C abi is already tested in this, so it is not that useful to test another one.
The tested code is blind to which specific ABI for now, as long as it's not an intrinsic one

3 years agoAuto merge of #86778 - tmiasko:fast-multiline, r=davidtwco
bors [Sat, 3 Jul 2021 16:06:35 +0000 (16:06 +0000)]
Auto merge of #86778 - tmiasko:fast-multiline, r=davidtwco

Avoid byte to char position conversions in `is_multiline`

Converting a byte position into a char position is currently linear in
the number of multibyte characters in the source code. Avoid it when
checking if a range spans across lines.

This makes it feasible to compile source files with a large number of
multibyte characters.

3 years agoAuto merge of #86810 - ojeda:alloc-gate, r=dtolnay
bors [Sat, 3 Jul 2021 13:23:28 +0000 (13:23 +0000)]
Auto merge of #86810 - ojeda:alloc-gate, r=dtolnay

alloc: `no_global_oom_handling`: disable `new()`s, `pin()`s, etc.

They are infallible, and could not be actually used because
they will trigger an error when monomorphized, but it is better
to just remove them.

Link: https://github.com/Rust-for-Linux/linux/pull/402
Suggested-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
3 years agoAuto merge of #86799 - tlyu:stdio-locked, r=joshtriplett
bors [Sat, 3 Jul 2021 10:40:53 +0000 (10:40 +0000)]
Auto merge of #86799 - tlyu:stdio-locked, r=joshtriplett

add owned locked stdio handles

Add stderr_locked, stdin_locked, and stdout_locked free functions
to obtain owned locked stdio handles in a single step. Also add
into_lock methods to consume a stdio handle and return an owned
lock. These methods will make it easier to use locked stdio
handles without having to deal with lifetime problems or keeping
bindings to the unlocked handles around.

Fixes #85383; enables #86412.

r? `@joshtriplett`
`@rustbot` label +A-io +C-enhancement +D-newcomer-roadblock +T-libs-api

3 years agoAuto merge of #86571 - fee1-dead:const-trait-impl-fix, r=jackh726
bors [Sat, 3 Jul 2021 07:24:24 +0000 (07:24 +0000)]
Auto merge of #86571 - fee1-dead:const-trait-impl-fix, r=jackh726

deny using default function in impl const Trait

Fixes #79450.

I don't know if my implementation is correct:

 - The check is in `rustc_passes::check_const`, should I put it somewhere else instead?
 - Is my approach (to checking the impl) optimal? It works for the current tests, but it might have some issues or there might be a better way of doing this.

3 years agoAuto merge of #79965 - ijackson:moreerrnos, r=joshtriplett
bors [Sat, 3 Jul 2021 04:12:36 +0000 (04:12 +0000)]
Auto merge of #79965 - ijackson:moreerrnos, r=joshtriplett

More ErrorKinds for common errnos

From the commit message of the main commit here (as revised):

```
There are a number of IO error situations which it would be very
useful for Rust code to be able to recognise without having to resort
to OS-specific code.  Taking some Unix examples, `ENOTEMPTY` and
`EXDEV` have obvious recovery strategies.  Recently I was surprised to
discover that `ENOSPC` came out as `ErrorKind::Other`.

Since I am familiar with Unix I reviwed the list of errno values in
  https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html

Here, I add those that most clearly seem to be needed.

`@CraftSpider` provided information about Windows, and references, which
I have tried to take into account.

This has to be insta-stable because we can't sensibly have a different
set of ErrorKinds depending on a std feature flag.

I have *not* added these to the mapping tables for any operating
systems other than Unix and Windows.  I hope that it is OK to add them
now for Unix and Windows now, and maybe add them to other OS's mapping
tables as and when someone on that OS is able to consider the
situation.

I adopted the general principle that it was usually a bad idea to map
two distinct error values to the same Rust error code.  I notice that
this principle is already violated in the case of `EACCES` and
`EPERM`, which both map to `PermissionDenied`.  I think this was
probably a mistake but it would be quite hard to change now, so I
don't propose to do anything about that.

However, for Windows, there are sometimes different error codes for
identical situations.  Eg there are WSA* versions of some error
codes as well as ERROR_* ones.  Also Windows seems to have a great
many more erorr codes.  I don't know precisely what best practice
would be for Windows.
```

<strike>

```
Errno values I wasn't sure about so *haven't* included:

EMFILE ENFILE ENOBUFS ENOLCK:

  These are all fairly Unix-specific resource exhaustion situations.
  In practice it seemed not very likely to me that anyone would want
  to handle these differently to `Other`.

ENOMEM ERANGE EDOM EOVERFLOW

  Normally these don't get exposed to the Rust callers I hope.  They
  don't tend to come out of filesystem APIs.

EILSEQ

  Hopefully Rust libraries open files in binary mode and do the
  converstion in Rust.  So Rust code ought not to be exposed to
  EILSEQ.

EIO

  The range of things that could cause this is troublesome.  I found
  it difficult to describe.  I do think it would be useful to add this
  at some point, because EIO on a filesystem operation is much more
  serious than most other errors.

ENETDOWN

  I wasn't sure if this was useful or, indeed, if any modern systems
  use it.

ENOEXEC

  It is not clear to me how a Rust program could respond to this.  It
  seems rather niche.

EPROTO ENETRESET ENODATA ENOMSG ENOPROTOOPT ENOSR ENOSTR ETIME
ENOTRECOVERABLE EOWNERDEAD EBADMSG EPROTONOSUPPORT EPROTOTYPE EIDRM

  These are network or STREAMS related errors which I have never in
  my own Unix programming found the need to do anything with.  I think
  someone who understands these better should be the one to try to
  find good Rust names and descriptions for them.

ENOTTY ENXIO ENODEV EOPNOTSUPP ESRCH EALREADY ECANCELED ECHILD
EINPROGRESS

  These are very hard to get unless you're already doing something
  very Unix-specific, in which case the raw_os_error interface is
  probably more suitable than relying on the Rust ErrorKind mapping.

EFAULT EBADF

  These would seem to be the result of application UB.
```
</strike>
<i>(omitted errnos are discussed below, especially in https://github.com/rust-lang/rust/pull/79965#issuecomment-810468334)

3 years agoAuto merge of #86795 - JohnTitor:fix-bind, r=jackh726
bors [Sat, 3 Jul 2021 01:42:06 +0000 (01:42 +0000)]
Auto merge of #86795 - JohnTitor:fix-bind, r=jackh726

Fix const-generics ICE related to binding

Fixes #83765, fixes #85848
r? `@jackh726` as you're familiar with `Binding`. I'd like to get some views if the current approach is right path.

3 years agostdio_locked: updates based on feedback
Taylor Yu [Fri, 2 Jul 2021 20:56:56 +0000 (15:56 -0500)]
stdio_locked: updates based on feedback

Rename methods to `into_locked`. Remove type aliases for owned locks.

3 years agoAuto merge of #86817 - JohnTitor:rollup-rcysc95, r=JohnTitor
bors [Fri, 2 Jul 2021 20:00:51 +0000 (20:00 +0000)]
Auto merge of #86817 - JohnTitor:rollup-rcysc95, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #84029 (add `track_path::path` fn for usage in `proc_macro`s)
 - #85001 (Merge `sys_common::bytestring` back into `os_str_bytes`)
 - #86308 (Docs: clarify that certain intrinsics are not unsafe)
 - #86796 (Add a regression test for issue-70703)
 - #86803 (Remove & from Command::args calls in documentation)
 - #86807 (Fix double import in wasm thread )
 - #86813 (Add a help message to `unused_doc_comments` lint)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #86813 - JohnTitor:unused-doc-comments-help, r=jackh726
Yuki Okushi [Fri, 2 Jul 2021 18:15:14 +0000 (03:15 +0900)]
Rollup merge of #86813 - JohnTitor:unused-doc-comments-help, r=jackh726

Add a help message to `unused_doc_comments` lint

Fixes #83492
This adds a help message to suggest a plain comment like the E0658 error. I've yet to come up with the best message about the doc attribute but the current shouldn't harm anything.
I was thinking of recovering in the `doc_comment_between_if_else` case, but I came to the conclusion that it unlikely happened and was an overkill.

3 years agoRollup merge of #86807 - tversteeg:patch-1, r=bjorn3
Yuki Okushi [Fri, 2 Jul 2021 18:15:13 +0000 (03:15 +0900)]
Rollup merge of #86807 - tversteeg:patch-1, r=bjorn3

Fix double import in wasm thread

The `unsupported` type is imported two times, as `super::unsupported` and as `crate::sys::unsupported`, throwing an error. Remove `super::unsupported` in favor of the other.

As reported in #86802.

Fix #86802

3 years agoRollup merge of #86803 - xfix:remove-unnecessary-ampersand-from-command-args-calls...
Yuki Okushi [Fri, 2 Jul 2021 18:15:12 +0000 (03:15 +0900)]
Rollup merge of #86803 - xfix:remove-unnecessary-ampersand-from-command-args-calls, r=joshtriplett

Remove & from Command::args calls in documentation

Now that arrays implement `IntoIterator`, using `&` is no longer necessary. This makes examples easier to understand.

3 years agoRollup merge of #86796 - JohnTitor:test-70703, r=jonas-schievink
Yuki Okushi [Fri, 2 Jul 2021 18:15:11 +0000 (03:15 +0900)]
Rollup merge of #86796 - JohnTitor:test-70703, r=jonas-schievink

Add a regression test for issue-70703

Closes #70703

3 years agoRollup merge of #86308 - bstrie:intrinsafe, r=JohnTitor
Yuki Okushi [Fri, 2 Jul 2021 18:15:10 +0000 (03:15 +0900)]
Rollup merge of #86308 - bstrie:intrinsafe, r=JohnTitor

Docs: clarify that certain intrinsics are not unsafe

As determined by the hardcoded list at https://github.com/rust-lang/rust/blob/003b8eadd7a476c51956fe447894532d6e21937e/compiler/rustc_typeck/src/check/intrinsic.rs#L59-L92

3 years agoRollup merge of #85001 - CDirkx:bytestring, r=JohnTitor
Yuki Okushi [Fri, 2 Jul 2021 18:15:09 +0000 (03:15 +0900)]
Rollup merge of #85001 - CDirkx:bytestring, r=JohnTitor

Merge `sys_common::bytestring` back into `os_str_bytes`

`bytestring` contains code for correctly debug formatting a byte slice (`[u8]`). This functionality is and has historically only been used to provide the debug formatting of byte-based os-strings (on unix etc.).

Having this functionality in the separate `bytestring` module was useful in the past to reduce duplication, as [when it was added](https://github.com/rust-lang/rust/pull/46798) `os_str_bytes` was still split into `sys::{unix, redox, wasi, etc.}::os_str`. However, now that is no longer the case, there is not much reason for the `bytestring` functionality to be separate from `os_str_bytes`; I don't think it is very likely that another part of std will need to handle formatting byte strings that are not os-strings in the future (everything should be `utf8`). This is why this PR merges the functionality of `bytestring` directly into the debug implementation in `os_str_bytes`.

3 years agoRollup merge of #84029 - drahnr:master, r=petrochenkov
Yuki Okushi [Fri, 2 Jul 2021 18:15:07 +0000 (03:15 +0900)]
Rollup merge of #84029 - drahnr:master, r=petrochenkov

add `track_path::path` fn for usage in `proc_macro`s

Adds a way to declare a dependency on external files without including them, to either re-trigger the build of a file as well as covering the use case of including dependencies within the `rustc` invocation, such that tools like `sccache`/`cachepot` are able to handle references to external files which are not included.

Ref #73921

3 years agoSimplify `visit_region` implementation
Yuki Okushi [Fri, 2 Jul 2021 17:13:17 +0000 (02:13 +0900)]
Simplify `visit_region` implementation

3 years agoAuto merge of #85269 - dpaoliello:dpaoliello/DebugSymbols, r=michaelwoerister
bors [Fri, 2 Jul 2021 17:19:32 +0000 (17:19 +0000)]
Auto merge of #85269 - dpaoliello:dpaoliello/DebugSymbols, r=michaelwoerister

Improve debug symbol names to avoid ambiguity and work better with MSVC's debugger

There are several cases where names of types and functions in the debug info are either ambiguous, or not helpful, such as including ambiguous placeholders (e.g., `{{impl}}`, `{{closure}}` or `dyn _'`) or dropping qualifications (e.g., for dynamic types).

Instead, each debug symbol name should be unique and useful:
* Include disambiguators for anonymous `DefPathDataName` (closures and generators), and unify their formatting when used as a path-qualifier vs item being qualified.
* Qualify the principal trait for dynamic types.
* If there is no principal trait for a dynamic type, emit all other traits instead.
* Respect the `qualified` argument when emitting ref and pointer types.
* For implementations, emit the disambiguator.
* Print const generics when emitting generic parameters or arguments.

Additionally, when targeting MSVC, its debugger treats many command arguments as C++ expressions, even when the argument is defined to be a symbol name. As such names in the debug info need to be more C++-like to be parsed correctly:
* Avoid characters with special meaning (`#`, `[`, `"`, `+`).
* Never start a name with `<` or `{` as this is treated as an operator.
* `>>` is always treated as a right-shift, even when parsing generic arguments (so add a space to avoid this).
* Emit function declarations using C/C++ style syntax (e.g., leading return type).
* Emit arrays as a synthetic `array$<type, size>` type.
* Include a `$` in all synthetic types as this is a legal character for C++, but not Rust (thus we avoid collisions with user types).

3 years agoRemove `ty::Binder::bind()`
Yuki Okushi [Fri, 2 Jul 2021 09:48:34 +0000 (18:48 +0900)]
Remove `ty::Binder::bind()`

Co-authored-by: Noah Lev <camelidcamel@gmail.com>
3 years agoCorrect `visit_region` implementation
Yuki Okushi [Fri, 2 Jul 2021 09:14:28 +0000 (18:14 +0900)]
Correct `visit_region` implementation

3 years agoUse `BoundVarsCollector` for now
Yuki Okushi [Fri, 2 Jul 2021 01:14:13 +0000 (10:14 +0900)]
Use `BoundVarsCollector` for now

3 years agoFix const-generics ICE related to binding
Yuki Okushi [Thu, 1 Jul 2021 23:02:11 +0000 (08:02 +0900)]
Fix const-generics ICE related to binding

3 years agoAdd a help message to `unused_doc_comments` lint
Yuki Okushi [Fri, 2 Jul 2021 16:00:08 +0000 (01:00 +0900)]
Add a help message to `unused_doc_comments` lint

3 years agoFix type name difference between i686 and x86_64 for test
Wesley Wiser [Fri, 2 Jul 2021 14:31:22 +0000 (10:31 -0400)]
Fix type name difference between i686 and x86_64 for test

3 years agoAuto merge of #86805 - hyd-dev:miri, r=RalfJung
bors [Fri, 2 Jul 2021 14:23:32 +0000 (14:23 +0000)]
Auto merge of #86805 - hyd-dev:miri, r=RalfJung

Update Miri

Fixes #86792.

r? `@RalfJung`

3 years agoalloc: `no_global_oom_handling`: disable `new()`s, `pin()`s, etc.
Miguel Ojeda [Fri, 2 Jul 2021 12:55:20 +0000 (14:55 +0200)]
alloc: `no_global_oom_handling`: disable `new()`s, `pin()`s, etc.

They are infallible, and could not be actually used because
they will trigger an error when monomorphized, but it is better
to just remove them.

Link: https://github.com/Rust-for-Linux/linux/pull/402
Suggested-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
3 years agoAuto merge of #86806 - GuillaumeGomez:rollup-pr5r37w, r=GuillaumeGomez
bors [Fri, 2 Jul 2021 11:42:38 +0000 (11:42 +0000)]
Auto merge of #86806 - GuillaumeGomez:rollup-pr5r37w, r=GuillaumeGomez

Rollup of 5 pull requests

Successful merges:

 - #85749 (Revert "Don't load all extern crates unconditionally")
 - #86714 (Add linked list cursor end methods)
 - #86737 (Document rustfmt on nightly-rustc)
 - #86776 (Skip layout query when computing integer type size during mangling)
 - #86797 (Stabilize `Bound::cloned()`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoFix double import in wasm thread
Thomas Versteeg [Fri, 2 Jul 2021 09:37:00 +0000 (09:37 +0000)]
Fix double import in wasm thread

The `unsupported` type is imported two times, as `super::unsupported` and as `crate::sys::unsupported`, throwing an error. Remove `super::unsupported` in favor of the other.

3 years agoRollup merge of #86797 - inquisitivecrystal:bound-cloned, r=jyn514
Guillaume Gomez [Fri, 2 Jul 2021 09:35:31 +0000 (11:35 +0200)]
Rollup merge of #86797 - inquisitivecrystal:bound-cloned, r=jyn514

Stabilize `Bound::cloned()`

This PR stabilizes the function `Bound::cloned()`.

Closes #61356.

3 years agoRollup merge of #86776 - tmiasko:v0-skip-layout-query, r=petrochenkov
Guillaume Gomez [Fri, 2 Jul 2021 09:35:30 +0000 (11:35 +0200)]
Rollup merge of #86776 - tmiasko:v0-skip-layout-query, r=petrochenkov

Skip layout query when computing integer type size during mangling

3 years agoRollup merge of #86737 - jyn514:doc-tools, r=Mark-Simulacrum
Guillaume Gomez [Fri, 2 Jul 2021 09:35:29 +0000 (11:35 +0200)]
Rollup merge of #86737 - jyn514:doc-tools, r=Mark-Simulacrum

Document rustfmt on nightly-rustc

- Refactor the doc step for Rustdoc into a macro
- Call the macro for both rustdoc and rustfmt
- Add a `recursion_limit` macro to avoid overflow errors

This does not currently pass --document-private-items for rustfmt due to https://github.com/rust-lang/cargo/pull/8422#issuecomment-871082935.

r? `@Mark-Simulacrum` cc `@calebcartwright`

3 years agoRollup merge of #86714 - iwahbe:add-linked-list-cursor-end-methods, r=Amanieu
Guillaume Gomez [Fri, 2 Jul 2021 09:35:28 +0000 (11:35 +0200)]
Rollup merge of #86714 - iwahbe:add-linked-list-cursor-end-methods, r=Amanieu

Add linked list cursor end methods

I add several methods to `LinkedList::CursorMut` and `LinkedList::Cursor`. These methods allow you to access/manipulate the ends of a list via the cursor. This is especially helpful when scanning through a list and reordering. For example:

```rust
let mut c = ll.back_cursor_mut();
let mut moves = 10;
while c.current().map(|x| x > 5).unwrap_or(false) {
    let n = c.remove_current();
    c.push_front(n);
    if moves > 0 { break; } else { moves -= 1; }
}
```
I encountered this problem working on my bachelors thesis doing graph index manipulation.

While this problem can be avoided by splicing, it is awkward. I asked about the problem [here](https://internals.rust-lang.org/t/linked-list-cursurmut-missing-methods/14921/4) and it was suggested I write a PR.

All methods added consist of
```rust
Cursor::front(&self) -> Option<&T>;
Cursor::back(&self) -> Option<&T>;
CursorMut::front(&self) -> Option<&T>;
CursorMut::back(&self) -> Option<&T>;
CursorMut::front_mut(&mut self) -> Option<&mut T>;
CursorMut::back_mut(&mut self) -> Option<&mut T>;
CursorMut::push_front(&mut self, elt: T);
CursorMut::push_back(&mut self, elt: T);
CursorMut::pop_front(&mut self) -> Option<T>;
CursorMut::pop_back(&mut self) -> Option<T>;
```
#### Design decisions:
I tried to remain as consistent as possible with what was already present for linked lists.
The methods `front`, `front_mut`, `back` and `back_mut` are identical to their `LinkedList` equivalents.

I tried to make the `pop_front` and `pop_back` methods work the same way (vis a vis the "ghost" node) as `remove_current`. I thought this was the closest analog.

`push_front` and `push_back` do not change the "current" node, even if it is the "ghost" node. I thought it was most intuitive to say that if you add to the list, current will never change.

Any feedback would be welcome :smile:

3 years agoRollup merge of #85749 - GuillaumeGomez:revert-smart-extern-crate-load, r=jyn514
Guillaume Gomez [Fri, 2 Jul 2021 09:35:27 +0000 (11:35 +0200)]
Rollup merge of #85749 - GuillaumeGomez:revert-smart-extern-crate-load, r=jyn514

Revert "Don't load all extern crates unconditionally"

Fixes https://github.com/rust-lang/rust/issues/84738.

This reverts https://github.com/rust-lang/rust/pull/83738.

For the "smart" load of external crates, we need to be able to access their items in order to check their doc comments, which seems, if not impossible, quite complicated using only the AST.

For some context, I first tried to extend the `IntraLinkCrateLoader` visitor by adding `visit_foreign_item`. Unfortunately, it never enters into this call, so definitely not the right place...

I then added `visit_use_tree` to then check all the imports outside with something like this:

```rust
let mut loader = crate::passes::collect_intra_doc_links::IntraLinkCrateLoader::new(resolver);
    ast::visit::walk_crate(&mut loader, krate);

    let mut items = Vec::new();
    for import in &loader.imports_to_check {
        if let Some(item) = krate.items.iter().find(|i| i.id == *import) {
            items.push(item);
        }
    }
    for item in items {
        ast::visit::walk_item(&mut item);
        for attr in &item.attrs {
            loader.check_attribute(attr);
        }
    }
```

This was, of course, a failure. We find the items without problems, but we still can't go into the external crate to check its items' attributes.

Finally, `@jyn514` suggested to look into the [`CrateLoader`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/creader/struct.CrateLoader.html), but it only seems to provide metadata (I went through [`CStore`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/creader/struct.CStore.html) and [`CrateMetadata`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/rmeta/decoder/struct.CrateMetadata.html)).

I think we are too limited here (with AST only) to be able to determine the crates we actually need to import, but it's very likely that I missed something. Maybe `@petrochenkov` or `@Aaron1011` have an idea?

So until we find a way to make it work completely, we need to revert it to fix the ICE. Once merged, we'll need to re-open #68427.

r? `@jyn514`

3 years agoUpdate Miri
hyd-dev [Fri, 2 Jul 2021 09:23:45 +0000 (17:23 +0800)]
Update Miri

3 years agoRemove & from Command::args calls in documentation
Konrad Borowski [Fri, 2 Jul 2021 09:10:00 +0000 (11:10 +0200)]
Remove & from Command::args calls in documentation

Now that arrays implement `IntoIterator`, using
`&` is no longer necessary. This makes examples
easier to understand.

3 years agoAuto merge of #85746 - m-ou-se:io-error-other, r=joshtriplett
bors [Fri, 2 Jul 2021 09:01:42 +0000 (09:01 +0000)]
Auto merge of #85746 - m-ou-se:io-error-other, r=joshtriplett

Redefine `ErrorKind::Other` and stop using it in std.

This implements the idea I shared yesterday in the libs meeting when we were discussing how to handle adding new `ErrorKind`s to the standard library: This redefines `Other` to be for *user defined errors only*, and changes all uses of `Other` in the standard library to a `#[doc(hidden)]` and permanently `#[unstable]` `ErrorKind` that users can not match on. This ensures that adding `ErrorKind`s at a later point in time is not a breaking change, since the user couldn't match on these errors anyway. This way, we use the `#[non_exhaustive]` property of the enum in a more effective way.

Open questions:
- How do we check this change doesn't cause too much breakage? Will a crate run help and be enough?
- How do we ensure we don't accidentally start using `Other` again in the standard library? We don't have a `pub(not crate)` or `#[deprecated(in this crate only)]`.

cc https://github.com/rust-lang/rust/pull/79965

cc `@rust-lang/libs` `@ijackson`

r? `@dtolnay`

3 years agoAuto merge of #80182 - in42:stack_trace, r=tmandry
bors [Fri, 2 Jul 2021 05:40:51 +0000 (05:40 +0000)]
Auto merge of #80182 - in42:stack_trace, r=tmandry

Implement printing of stack traces on LLVM segfaults and aborts

Implement #79153

Based on discussion, try to extend the rust_backtrace=1 feature to handle segfault or aborts in the llvm backend

3 years agoadd track_path::path fn for proc-macro usage
Bernhard Schuster [Fri, 9 Apr 2021 14:35:40 +0000 (16:35 +0200)]
add track_path::path fn for proc-macro usage

Ref #73921

3 years agoAuto merge of #86782 - flip1995:clippyup, r=Manishearth
bors [Fri, 2 Jul 2021 02:56:45 +0000 (02:56 +0000)]
Auto merge of #86782 - flip1995:clippyup, r=Manishearth

Update Clippy

Biweekly Clippy Update

r? `@Manishearth`

3 years agoadd owned locked stdio handles
Taylor Yu [Thu, 1 Jul 2021 23:05:24 +0000 (18:05 -0500)]
add owned locked stdio handles

Add stderr_locked, stdin_locked, and stdout_locked free functions
to obtain owned locked stdio handles in a single step. Also add
into_lock methods to consume a stdio handle and return an owned
lock. These methods will make it easier to use locked stdio
handles without having to deal with lifetime problems or keeping
bindings to the unlocked handles around.

3 years agoUse signal handler only on supported platforms
Tyler Mandry [Fri, 2 Jul 2021 00:20:04 +0000 (00:20 +0000)]
Use signal handler only on supported platforms

3 years agoAuto merge of #86777 - tmiasko:estimate-terminators, r=estebank
bors [Fri, 2 Jul 2021 00:15:58 +0000 (00:15 +0000)]
Auto merge of #86777 - tmiasko:estimate-terminators, r=estebank

Include terminators in instance size estimate

For example, drop glue generated for struct below, doesn't have any
statements, only terminators. Previously it received an estimate of 0,
the new estimate is 13 (6+5 drop terminators, +1 resume, +1 return).

```rust
struct S {
    a: String,
    b: String,
    c: String,
    d: String,
    e: String,
    f: String,
}
```

Originally reported in https://github.com/rust-lang/rust/issues/69382#issue-569392141

3 years agoStabilize `Bound::cloned()`
Aris Merchant [Fri, 2 Jul 2021 00:05:08 +0000 (17:05 -0700)]
Stabilize `Bound::cloned()`

3 years agoDocument rustfmt on nightly-rustc
Joshua Nelson [Wed, 30 Jun 2021 04:13:34 +0000 (00:13 -0400)]
Document rustfmt on nightly-rustc

The recursion_limit attribute avoids the following error:

```
error[E0275]: overflow evaluating the requirement `std::ptr::Unique<rustc_ast::Pat>: std::marker::Send`
  |
  = help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`rustfmt_nightly`)
```

3 years agoAdd a regression test for issue-70703
Yuki Okushi [Thu, 1 Jul 2021 23:31:51 +0000 (08:31 +0900)]
Add a regression test for issue-70703

3 years agoAuto merge of #86791 - JohnTitor:rollup-96ltzpz, r=JohnTitor
bors [Thu, 1 Jul 2021 21:45:19 +0000 (21:45 +0000)]
Auto merge of #86791 - JohnTitor:rollup-96ltzpz, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #86148 (Check the number of generic lifetime and const parameters of intrinsics)
 - #86659 (fix(rustdoc): generics search)
 - #86768 (Add myself to mailmap)
 - #86775 (Test for const trait impls behind feature gates)
 - #86779 (Allow anyone to add or remove any label starting with perf-)
 - #86783 (Move Mutex::unlock to T: ?Sized)
 - #86785 (proc_macro/bridge: Remove dead code Slice type)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #86785 - lf-:dead-code, r=Mark-Simulacrum
Yuki Okushi [Thu, 1 Jul 2021 21:20:34 +0000 (06:20 +0900)]
Rollup merge of #86785 - lf-:dead-code, r=Mark-Simulacrum

proc_macro/bridge: Remove dead code Slice type

See https://github.com/rust-lang/rust/pull/85390#discussion_r662464868

3 years agoRollup merge of #86783 - mark-i-m:mutex-drop-unsized, r=Xanewok
Yuki Okushi [Thu, 1 Jul 2021 21:20:33 +0000 (06:20 +0900)]
Rollup merge of #86783 - mark-i-m:mutex-drop-unsized, r=Xanewok

Move Mutex::unlock to T: ?Sized

r? ``@mbrubeck``

cc https://github.com/rust-lang/rust/issues/81872

3 years agoRollup merge of #86779 - rylev:all-perf-labels, r=Mark-Simulacrum
Yuki Okushi [Thu, 1 Jul 2021 21:20:32 +0000 (06:20 +0900)]
Rollup merge of #86779 - rylev:all-perf-labels, r=Mark-Simulacrum

Allow anyone to add or remove any label starting with perf-

In order to fully realize planned changes to the performance tracking process, we'd like to allow anyone to change the perf related labels.

r? ``@Mark-Simulacrum``

3 years agoRollup merge of #86775 - fee1-dead:impl-const-test, r=jonas-schievink
Yuki Okushi [Thu, 1 Jul 2021 21:20:31 +0000 (06:20 +0900)]
Rollup merge of #86775 - fee1-dead:impl-const-test, r=jonas-schievink

Test for const trait impls behind feature gates

 - Make the previous cross-crate tests use revisions instead of being separate files
 - Added test for gating const trait impls.

cc ``@oli-obk`` ``@jonas-schievink``

3 years agoRollup merge of #86768 - fee1-dead:patch-2, r=bjorn3
Yuki Okushi [Thu, 1 Jul 2021 21:20:30 +0000 (06:20 +0900)]
Rollup merge of #86768 - fee1-dead:patch-2, r=bjorn3

Add myself to mailmap

3 years agoRollup merge of #86659 - notriddle:notriddle/generics-rustdoc, r=GuillaumeGomez
Yuki Okushi [Thu, 1 Jul 2021 21:20:29 +0000 (06:20 +0900)]
Rollup merge of #86659 - notriddle:notriddle/generics-rustdoc, r=GuillaumeGomez

fix(rustdoc): generics search

This commit adds a test case for generics, re-adds generics data
to the search index, and tweaks function indexing to use less space in JSON.

This partially reverts commit 14ca89446c076bcf484d3d05bd991a4b7985a409.

3 years agoRollup merge of #86148 - FabianWolff:issue-85855, r=varkor
Yuki Okushi [Thu, 1 Jul 2021 21:20:28 +0000 (06:20 +0900)]
Rollup merge of #86148 - FabianWolff:issue-85855, r=varkor

Check the number of generic lifetime and const parameters of intrinsics

This pull request fixes #85855. The current code for type checking intrinsics only checks the number of generic _type_ parameters, but does not check for an incorrect number of lifetime or const parameters, which can cause problems later on, such as the ICE in #85855, where the code thought that it was looking at a type parameter but found a lifetime parameter:
```
error: internal compiler error: compiler/rustc_middle/src/ty/generics.rs:188:18:
    expected type parameter, but found another generic parameter
```

The changes in this PR add checks for the number of lifetime and const parameters, expand the scope of `E0094` to also apply to these cases, and improve the error message by properly pluralizing the number of expected generic parameters.

3 years agoImplement changes suggested by @Amanieu
Ian Wahbe [Thu, 1 Jul 2021 19:08:01 +0000 (21:08 +0200)]
Implement changes suggested by @Amanieu

3 years agoAuto merge of #86749 - bjorn3:link_info_refactor_part1, r=petrochenkov
bors [Thu, 1 Jul 2021 19:00:08 +0000 (19:00 +0000)]
Auto merge of #86749 - bjorn3:link_info_refactor_part1, r=petrochenkov

Rename all_crate_nums query to crates and remove useless wrapper

Split out of https://github.com/rust-lang/rust/pull/86105

r? `@petrochenkov`

3 years agoUpdate cdb tests for expected output
Wesley Wiser [Thu, 1 Jul 2021 18:26:20 +0000 (14:26 -0400)]
Update cdb tests for expected output

Also an fix issue with tuple type names where we can't cast to them in
natvis (required by the visualizer for `HashMap`) because of
peculiarities with the natvis expression evaluator.

3 years agoproc_macro/bridge: Remove dead code Slice type
Jade [Thu, 1 Jul 2021 17:20:57 +0000 (10:20 -0700)]
proc_macro/bridge: Remove dead code Slice type

See https://github.com/rust-lang/rust/pull/85390#discussion_r662464868

3 years agoMove Mutex::unlock to T: ?Sized
Mark Mansi [Thu, 1 Jul 2021 17:04:41 +0000 (12:04 -0500)]
Move Mutex::unlock to T: ?Sized

3 years agoRevert "Don't load all extern crates unconditionally"
Guillaume Gomez [Thu, 27 May 2021 14:06:30 +0000 (16:06 +0200)]
Revert "Don't load all extern crates unconditionally"

3 years agoUpdate Cargo.lock
flip1995 [Thu, 1 Jul 2021 16:18:02 +0000 (18:18 +0200)]
Update Cargo.lock

3 years agoMerge commit '61eb38aeda6cb54b93b872bf503d70084c4d621c' into clippyup
flip1995 [Thu, 1 Jul 2021 16:17:38 +0000 (18:17 +0200)]
Merge commit '61eb38aeda6cb54b93b872bf503d70084c4d621c' into clippyup

3 years agoAuto merge of #86304 - klensy:hex-length, r=jackh726
bors [Thu, 1 Jul 2021 16:16:12 +0000 (16:16 +0000)]
Auto merge of #86304 - klensy:hex-length, r=jackh726

rustc_mir: calc hex number length without string allocation

3 years agoMinor adjustments and refactoring
Fabian Wolff [Thu, 1 Jul 2021 11:52:44 +0000 (13:52 +0200)]
Minor adjustments and refactoring

3 years agoAuto merge of #7418 - flip1995:rustup, r=flip1995
bors [Thu, 1 Jul 2021 15:43:14 +0000 (15:43 +0000)]
Auto merge of #7418 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

3 years agoBump nightly version -> 2021-07-01
flip1995 [Thu, 1 Jul 2021 15:41:34 +0000 (17:41 +0200)]
Bump nightly version -> 2021-07-01

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 1 Jul 2021 15:17:19 +0000 (17:17 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoAuto merge of #7407 - m-ou-se:doc-hidden-variants, r=flip1995
bors [Thu, 1 Jul 2021 15:02:21 +0000 (15:02 +0000)]
Auto merge of #7407 - m-ou-se:doc-hidden-variants, r=flip1995

Don't suggest doc(hidden) or unstable variants in wildcard lint

Clippy's wildcard lint would suggest doc(hidden) and unstable variants for non_exhaustive enums, even though those aren't part of the public interface (yet) and should only be matched on using a `_`, just like potential future additions to the enum. There was already some logic to exclude a *single* doc(hidden) variant. This extends that to all hidden variants, and also hides `#[unstable]` variants.

See https://github.com/rust-lang/rust/pull/85746#issuecomment-868886893

This PR includes https://github.com/rust-lang/rust-clippy/pull/7406 as the first commit.

Here's the diff that this PR adds on top of that PR: https://github.com/m-ou-se/rust-clippy/compare/std-errorkind...m-ou-se:doc-hidden-variants

---

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: No longer suggest unstable and doc(hidden) variants in wildcard lint. wildcard_enum_match_arm, match_wildcard_for_single_variants

3 years agorustc_mir: calc hex number length without string allocation
klensy [Mon, 14 Jun 2021 18:32:42 +0000 (21:32 +0300)]
rustc_mir: calc hex number length without string allocation

3 years agoRename all_crate_nums query to crates and remove useless wrapper
bjorn3 [Mon, 7 Jun 2021 09:03:17 +0000 (11:03 +0200)]
Rename all_crate_nums query to crates and remove useless wrapper

3 years agofix(rustdoc): generics search
Michael Howell [Sat, 26 Jun 2021 19:00:26 +0000 (12:00 -0700)]
fix(rustdoc): generics search

This commit adds a test case for generics, re-adds generics data
to the search index, and tweaks function indexing to use less space in JSON.

This reverts commit 14ca89446c076bcf484d3d05bd991a4b7985a409.

3 years agoAuto merge of #86769 - ehuss:update-cargo, r=ehuss
bors [Thu, 1 Jul 2021 13:35:14 +0000 (13:35 +0000)]
Auto merge of #86769 - ehuss:update-cargo, r=ehuss

Update cargo

9 commits in 9233aa06c801801cff75df65df718d70905a235e..4952979031e2cf1d901c817a32e25a156a19db4c
2021-06-22 21:32:55 +0000 to 2021-07-01 01:14:50 +0000
- Fix `BorrowMutError` when calling `cargo doc --open` (rust-lang/cargo#9531)
- Exclude `target` from content-indexing on Windows (rust-lang/cargo#9635)
- Temporarily ignore 2021 edition fix. (rust-lang/cargo#9642)
- Temporarily disable future_incompat tests. (rust-lang/cargo#9638)
- Include toolchain specification in error message (rust-lang/cargo#9625)
- Error when packaging with git dependencies without version (rust-lang/cargo#9612)
- simply 'if' block (rust-lang/cargo#9615)
- tidy some closures and iterators (rust-lang/cargo#9614)
- use 'writeln' instead of appending newline character (rust-lang/cargo#9620)

3 years agoAllow anyone to add or remove any label starting with perf-
Ryan Levick [Thu, 1 Jul 2021 12:56:24 +0000 (14:56 +0200)]
Allow anyone to add or remove any label starting with perf-

3 years agoInclude terminators in instance size estimate
Tomasz Miąsko [Tue, 29 Jun 2021 00:00:00 +0000 (00:00 +0000)]
Include terminators in instance size estimate

For example, drop glue generated for struct below, doesn't have any
statements, only terminators. Previously it received an estimate of 0,
the new estimate is 13 (6+5 drop terminators, +1 resume, +1 return).

struct S {
    a: String,
    b: String,
    c: String,
    d: String,
    e: String,
    f: String,
}

Originally reported in https://github.com/rust-lang/rust/issues/69382#issue-569392141

3 years agoAvoid byte to char position conversions in is_multiline
Tomasz Miąsko [Thu, 1 Jul 2021 00:00:00 +0000 (00:00 +0000)]
Avoid byte to char position conversions in is_multiline

Converting a byte position into a char position is currently linear in
the number of multibyte characters in the source code. Avoid it when
checking if a range spans across lines.

This makes it feasible to compile source files with a large number of
multibyte characters.

3 years agoTest for const trait impls behind feature gates
Deadbeef [Thu, 1 Jul 2021 10:43:08 +0000 (18:43 +0800)]
Test for const trait impls behind feature gates

3 years agomatch_wildcard_for_single_variants: don't produce bad suggestion
flip1995 [Thu, 1 Jul 2021 10:35:16 +0000 (12:35 +0200)]
match_wildcard_for_single_variants: don't produce bad suggestion

This fixes a bug where match_wildcard_for_single_variants produced a
bad suggestion where besides the missing variant, one or more hidden
variants were left.

This also adds tests to the ui-tests match_wildcard_for_single_variants
and wildcard_enum_match_arm to make sure that the correct suggestion is
produced.

3 years agoSkip layout query when computing integer type size during mangling
Tomasz Miąsko [Thu, 1 Jul 2021 00:00:00 +0000 (00:00 +0000)]
Skip layout query when computing integer type size during mangling

3 years agoSimplify wildcard_enum_match_arm test
flip1995 [Thu, 1 Jul 2021 09:47:56 +0000 (11:47 +0200)]
Simplify wildcard_enum_match_arm test

3 years agoUse revisions for cross-crate test
Deadbeef [Thu, 1 Jul 2021 09:24:45 +0000 (17:24 +0800)]
Use revisions for cross-crate test

3 years agoAuto merge of #86774 - GuillaumeGomez:rollup-rkcgvph, r=GuillaumeGomez
bors [Thu, 1 Jul 2021 09:20:38 +0000 (09:20 +0000)]
Auto merge of #86774 - GuillaumeGomez:rollup-rkcgvph, r=GuillaumeGomez

Rollup of 6 pull requests

Successful merges:

 - #86558 (Add suggestions for "undefined reference" link errors)
 - #86616 (rustc_span: Explicitly handle crates that differ from package names)
 - #86652 (Add support for leaf function frame pointer elimination)
 - #86666 (Fix misleading "impl Trait" error)
 - #86762 (mailmap: Add my work email address)
 - #86773 (Enable the tests developed with #86594)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #86773 - dns2utf8:rustdoc_enable_near_tests, r=GuillaumeGomez
Guillaume Gomez [Thu, 1 Jul 2021 09:15:44 +0000 (11:15 +0200)]
Rollup merge of #86773 - dns2utf8:rustdoc_enable_near_tests, r=GuillaumeGomez

Enable the tests developed with #86594

This PR requires `browser-ui-test@0.4.1`. Can we centralise the version number somehow and maybe automatically install it when tests are run?

r? `@GuillaumeGomez`

3 years agoRollup merge of #86762 - JohnTitor:mailmap-for-work, r=Mark-Simulacrum
Guillaume Gomez [Thu, 1 Jul 2021 09:15:43 +0000 (11:15 +0200)]
Rollup merge of #86762 - JohnTitor:mailmap-for-work, r=Mark-Simulacrum

mailmap: Add my work email address

This de-duplicates the entry on the thanks.

3 years agoRollup merge of #86666 - ptrojahn:compare_kinds, r=petrochenkov
Guillaume Gomez [Thu, 1 Jul 2021 09:15:42 +0000 (11:15 +0200)]
Rollup merge of #86666 - ptrojahn:compare_kinds, r=petrochenkov

Fix misleading "impl Trait" error

The kinds can't be compared directly, as types with references are treated as different because the lifetimes aren't bound in ty, but are in expected.
Closes #84160

3 years agoRollup merge of #86652 - nagisa:nagisa/non-leaf-fp, r=petrochenkov
Guillaume Gomez [Thu, 1 Jul 2021 09:15:41 +0000 (11:15 +0200)]
Rollup merge of #86652 - nagisa:nagisa/non-leaf-fp, r=petrochenkov

Add support for leaf function frame pointer elimination

This PR adds ability for the target specifications to specify frame
pointer emission type that's not just “always” or “whatever cg decides”.

In particular there's a new mode that allows omission of the frame
pointer for leaf functions (those that don't call any other functions).

We then set this new mode for Aarch64-based Apple targets.

Fixes #86196

3 years agoRollup merge of #86616 - joshtriplett:simplify-crate-package-discrepancies, r=varkor
Guillaume Gomez [Thu, 1 Jul 2021 09:15:40 +0000 (11:15 +0200)]
Rollup merge of #86616 - joshtriplett:simplify-crate-package-discrepancies, r=varkor

rustc_span: Explicitly handle crates that differ from package names

The sha-1 and md-5 packages contain crates named sha1 and md5,
respectively. This discrepancy makes it somewhat more challenging to
automate detection of unused crates. Explicitly rename the packages to
the names of the crates they contain, to simplify such detection.

3 years agoRollup merge of #86558 - Smittyvb:link-error-sugg, r=petrochenkov
Guillaume Gomez [Thu, 1 Jul 2021 09:15:39 +0000 (11:15 +0200)]
Rollup merge of #86558 - Smittyvb:link-error-sugg, r=petrochenkov

Add suggestions for "undefined reference" link errors

This adds a suggestion for "undefined reference to ..." linking errors to install or specify the location to an external library. Since there is no defined error format for linkers, we just check if there was a failure and if that failure contains the string `undefined reference to`. This also makes it impossible to test this, since the output depends on the system linker. The output now looks like:
```
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "linking_failure.linking_failure.7rcbfp3g-cgu.0.rcgu.o" "linking_failure.linking_failure.7rcbfp3g-cgu.1.rcgu.o" "linking_failure.linking_failure.7rcbfp3g-cgu.2.rcgu.o" "linking_failure.linking_failure.7rcbfp3g-cgu.3.rcgu.o" "linking_failure.linking_failure.7rcbfp3g-cgu.4.rcgu.o" "linking_failure.linking_failure.7rcbfp3g-cgu.5.rcgu.o" "linking_failure.linking_failure.7rcbfp3g-cgu.6.rcgu.o" "linking_failure.linking_failure.7rcbfp3g-cgu.7.rcgu.o" "linking_failure.linking_failure.7rcbfp3g-cgu.8.rcgu.o" "linking_failure.53u64zklswtfazes.rcgu.o" "-Wl,--as-needed" "-L" "/home/smit/rustc-dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/home/smit/rustc-dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-01ce3ba5c629d02f.rlib" "/home/smit/rustc-dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-f1f2102409186354.rlib" "/home/smit/rustc-dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-1e8b6b56a999f838.rlib" "/home/smit/rustc-dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-d0e93eb4e14f1d19.rlib" "/home/smit/rustc-dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-1d7e39d75d082b43.rlib" "/home/smit/rustc-dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-ade42e945045b261.rlib" "/home/smit/rustc-dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-1a65064fccf4ebc1.rlib" "/home/smit/rustc-dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-4d699c310fdfe72d.rlib" "/home/smit/rustc-dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-1cafa68a696ec800.rlib" "/home/smit/rustc-dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-e9f1c8c4dab2f046.rlib" "/home/smit/rustc-dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-ecc1a743be25c7f7.rlib" "/home/smit/rustc-dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-e074031c4b66b6b6.rlib" "/home/smit/rustc-dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-9aa6ed9f1d3bfd53.rlib" "/home/smit/rustc-dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-7862bf96c2250ca0.rlib" "/home/smit/rustc-dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-f02ce0dc7895b5fd.rlib" "/home/smit/rustc-dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-3af9c60917570521.rlib" "/home/smit/rustc-dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-ca16fc7bb3645684.rlib" "-Wl,--end-group" "/home/smit/rustc-dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-d8e1a5b7299604cc.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/home/smit/rustc-dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "linking_failure" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs"
  = note: /usr/bin/ld: linking_failure.linking_failure.7rcbfp3g-cgu.3.rcgu.o: in function `linking_failure::main':
          linking_failure.7rcbfp3g-cgu.3:(.text._ZN15linking_failure4main17h52b6e3052e444479E+0x3): undefined reference to `doesnt_exist_thiwthwfyl'
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

  = help: some `extern` functions couldn't be found; you may need to install or specify the path to some dependencies
  = note: use the -L flag to specify the library lookup path
  = note: use the cargo:rustc-link-search directive to specify the library lookup path with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-search)

error: aborting due to previous error
```

3 years agoUpdate container browser-ui-test@0.4.1
Stefan Schindler [Thu, 1 Jul 2021 08:22:03 +0000 (10:22 +0200)]
Update container browser-ui-test@0.4.1

3 years agoEnable the tests developed with #86594
Stefan Schindler [Thu, 1 Jul 2021 08:13:28 +0000 (10:13 +0200)]
Enable the tests developed with #86594

3 years agoAuto merge of #86190 - asquared31415:extern-main-86110-fix, r=varkor
bors [Thu, 1 Jul 2021 06:39:37 +0000 (06:39 +0000)]
Auto merge of #86190 - asquared31415:extern-main-86110-fix, r=varkor

Fix ICE when `main` is declared in an `extern` block

Changes in #84401 to implement `imported_main` changed how the crate entry point is found, and a declared `main` in an `extern` block was detected erroneously.  This was causing the ICE described in #86110.

This PR adds a check for this case and emits an error instead.  Previously a `main` declaration in an `extern` block was not detected as an entry point at all, so emitting an error shouldn't break anything that worked previously.  In 1.52.1 stable this is demonstrated, with a `` `main` function not found`` error.

Fixes #86110

3 years agoUpdate cargo
Eric Huss [Thu, 1 Jul 2021 04:43:47 +0000 (21:43 -0700)]
Update cargo

3 years agoAuto merge of #86617 - joshtriplett:prune-dependencies, r=Mark-Simulacrum
bors [Thu, 1 Jul 2021 03:49:47 +0000 (03:49 +0000)]
Auto merge of #86617 - joshtriplett:prune-dependencies, r=Mark-Simulacrum

Remove unused dependencies from compiler crates

Various compiler crates have dependencies that they don't appear to use. I used some scripting to detect such dependencies, filtered them based on some manual review, and removed those that do indeed appear to be entirely unused.

3 years agoDo the check even when the feature is not enabled
Deadbeef [Mon, 28 Jun 2021 03:13:32 +0000 (11:13 +0800)]
Do the check even when the feature is not enabled

3 years agoUpdate mailmap for me
fee1-dead [Thu, 1 Jul 2021 02:05:37 +0000 (10:05 +0800)]
Update mailmap for me

3 years agoAuto merge of #86757 - JohnTitor:rollup-acevhz7, r=JohnTitor
bors [Thu, 1 Jul 2021 01:08:46 +0000 (01:08 +0000)]
Auto merge of #86757 - JohnTitor:rollup-acevhz7, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #85504 (the foundation owns rust trademarks)
 - #85520 (Fix typo and improve documentation for E0632)
 - #86680 (Improve error for missing -Z with debugging option)
 - #86728 (Check node kind to avoid ICE in `check_expr_return()`)
 - #86740 (copy rust-lld as ld in dist)
 - #86746 (Fix rustdoc query type filter)
 - #86750 (Test cross-crate usage of `feature(const_trait_impl)`)
 - #86755 (alloc: `RawVec<T, A>::shrink` can be in `no_global_oom_handling`.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agomailmap: Add my work email address
Yuki Okushi [Wed, 30 Jun 2021 22:37:31 +0000 (07:37 +0900)]
mailmap: Add my work email address

3 years agoAuto merge of #86489 - cjgillot:lower, r=petrochenkov
bors [Wed, 30 Jun 2021 22:20:36 +0000 (22:20 +0000)]
Auto merge of #86489 - cjgillot:lower, r=petrochenkov

Simplify early compilation interface

* separate resolver creation and AST configuration.
* bundle lowering with global_ctxt creation.

3 years agoAdd suggestions for "undefined reference" link errors
Smitty [Tue, 22 Jun 2021 21:46:34 +0000 (17:46 -0400)]
Add suggestions for "undefined reference" link errors

3 years agoRollup merge of #86755 - ojeda:shrink, r=Mark-Simulacrum
Yuki Okushi [Wed, 30 Jun 2021 20:21:03 +0000 (05:21 +0900)]
Rollup merge of #86755 - ojeda:shrink, r=Mark-Simulacrum

alloc: `RawVec<T, A>::shrink` can be in `no_global_oom_handling`.

Found in https://github.com/Rust-for-Linux/linux/pull/402.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
3 years agoRollup merge of #86750 - fee1-dead:impl-const-test, r=jonas-schievink
Yuki Okushi [Wed, 30 Jun 2021 20:21:02 +0000 (05:21 +0900)]
Rollup merge of #86750 - fee1-dead:impl-const-test, r=jonas-schievink

Test cross-crate usage of `feature(const_trait_impl)`

This PR does two things:

 - Fixes metadata not encoded properly for functions in const trait impls.
 - Adds tests for using const trait impls cross-crate with the feature gate on the user crate either enabled or disabled.

AFAIK, this means we can now constify some trait impls in the standard library 🎉

See #67792 for the tracking issue, cc `@oli-obk`

3 years agoRollup merge of #86746 - GuillaumeGomez:query-type-filter, r=notriddle
Yuki Okushi [Wed, 30 Jun 2021 20:21:00 +0000 (05:21 +0900)]
Rollup merge of #86746 - GuillaumeGomez:query-type-filter, r=notriddle

Fix rustdoc query type filter

I realized while reviewing #86659 that the type filter was broken on search so I'd prefer it to get merged before merging #86659.

r? `@notriddle`