Commit Graph

206302 Commits

Author SHA1 Message Date
Jhonny Bill Mena
5b8152807c UPDATE - move SessionDiagnostic from rustc_session to rustc_errors 2022-09-21 11:39:52 -04:00
Oli Scherer
47cb378526 Remove unused imports 2022-09-21 15:37:10 +00:00
Oli Scherer
f45b570e08 Add 'src/tools/miri/' from commit '75dd959a3a40eb5b4574f8d2e23aa6efbeb33573'
git-subtree-dir: src/tools/miri
git-subtree-mainline: 3f3167fb59
git-subtree-split: 75dd959a3a
2022-09-21 15:36:26 +00:00
Ralf Jung
3f3167fb59 miri is not in toolstate any more 2022-09-21 15:35:53 +00:00
Oli Scherer
7e23244ef1 HACK: Treat miri as if it were a submodule 2022-09-21 15:35:53 +00:00
Oli Scherer
6cfa7ef2ba Remove miri from the submodule list and require it for CI to pass 2022-09-21 15:35:53 +00:00
Oli Scherer
d9382d03bd Remove miri submodule 2022-09-21 15:35:53 +00:00
Aaron Hill
3d8b3e6ca1
Set 'exec-env:RUST_BACKTRACE=0' in const-eval-select tests
This allows the tests to pass even if the user has RUST_BACKTRACE
set when running 'x.py'
2022-09-21 10:25:03 -05:00
Deadbeef
898c76cd82 Make error messages great again (and fix clippy and add test) 2022-09-21 15:02:15 +00:00
Guillaume Gomez
6069f71e6c Add GUI test for .stab elements in docblocks 2022-09-21 16:40:31 +02:00
Guillaume Gomez
efbde853af Add doc aliases on Sized trait 2022-09-21 16:20:15 +02:00
Guillaume Gomez
150623eb6c Prevent usage of .stab elements to create scrollable areas in doc blocks 2022-09-21 16:12:14 +02:00
Dylan DPC
39bb2a7988
Rollup merge of #102059 - compiler-errors:issue-101984, r=jackh726
Use rebind instead of dummy binder in `SameTypeModuloInfer` relation

Lazy binder usage (sorry, my fault) + assertion in `Binder::dummy`

Fixes #101984
2022-09-21 19:01:09 +05:30
Dylan DPC
77d063b954
Rollup merge of #102058 - mqudsi:path_extension_docs, r=thomcc
Clarify Path::extension() semantics in docs abstract

State up-front and center what shape the returned extension will have, without making the user read through the description and examples.

This is a doc-only change. There are no changes to the API contract and the clarification is in line with what was already stated/promised in the existing doc text - just clarified, summarized, and served bright and early.

Rationale: Various frameworks and libraries for different platforms have their different conventions as to whether an "extension" is ".ext" or just "ext" and anyone that's had to deal with this ambiguity in the past is always double- or triple-checking to make sure the function call returns an extension that matches the expected semantics. Offer the answer to this important question right off the bat instead of making them dig to find it.

```@rustbot``` label +A-docs
2022-09-21 19:01:09 +05:30
Dylan DPC
7d7f55599a
Rollup merge of #102045 - RalfJung:const-prop-regression-fix, r=oli-obk
fix ConstProp handling of written_only_inside_own_block_locals

Fixes a regression introduced by https://github.com/rust-lang/rust/pull/100239, which adds an early return and thus skips some code in `visit_terminator` that must be run for soundness.

Fixes https://github.com/rust-lang/rust/issues/101973
2022-09-21 19:01:08 +05:30
Dylan DPC
4b7c596b3a
Rollup merge of #102041 - nnethercote:improve-meta-stats, r=bjorn3
Improve `-Zmeta-stats` some more

A follow-up to #97384.

r? ```@bjorn3```
2022-09-21 19:01:08 +05:30
Dylan DPC
36e39725fb
Rollup merge of #102031 - andrewpollack:compiler-tests-backtrace, r=tmandry
Adding ignore fuchsia tests for Backtrace, ErrorKind cases

Tests where Backtrace parses are required (invalid since Fuchsia backtraces are not symbolized), and test where ErrorKind is not properly translated from a Fuchsia-style to Unix-style error code

cc. ```@djkoloski```

r? ```@tmandry```
2022-09-21 19:01:07 +05:30
Dylan DPC
9b24a1f9a0
Rollup merge of #101995 - scottmcm:carrying-mul-example, r=Mark-Simulacrum
Add another example for `uN::carrying_mul`

The prose talks about doing this, so might as well add a simple code example of it too.
2022-09-21 19:01:07 +05:30
Dylan DPC
5377c31122
Rollup merge of #89891 - ojeda:modular-alloc, r=Mark-Simulacrum
`alloc`: add unstable cfg features `no_rc` and `no_sync`

In Rust for Linux we are using these to make `alloc` a bit more modular.

See https://github.com/rust-lang/rust/pull/86048 and https://github.com/rust-lang/rust/pull/84266 for similar requests.

Of course, the particular names are not important.
2022-09-21 19:01:06 +05:30
bors
75dd959a3a Auto merge of #2557 - RalfJung:triple-to-string, r=RalfJung
remove unnecessary to_string
2022-09-21 13:26:05 +00:00
Ralf Jung
c672c35ad6 format > to_string 2022-09-21 15:25:30 +02:00
Ralf Jung
33284ec099 remove unnecessary to_string 2022-09-21 15:24:06 +02:00
Oli Scherer
86f1ca812b Improve diagnostic for adding more bounds to opaque types 2022-09-21 13:15:24 +00:00
Oli Scherer
4b323e62ba Reproduce sad diagnostic 2022-09-21 13:15:24 +00:00
Oli Scherer
36cb01deb3 Try out a perf optimization 2022-09-21 13:15:24 +00:00
Oli Scherer
20d962cfa5 Simplify insert_outlives_predicate opaque type logic 2022-09-21 13:15:24 +00:00
Oli Scherer
615c9e8647 Inline substitution logic into declared_region_bounds 2022-09-21 13:11:54 +00:00
Oli Scherer
a8c9784336 Add regression test 2022-09-21 13:11:54 +00:00
Oli Scherer
90b6744af7 Also collect bounds from the ParamEnv for opaque types 2022-09-21 13:11:54 +00:00
Oli Scherer
37928f5986 Neither require nor imply lifetime bounds on opaque type for well formedness 2022-09-21 13:11:54 +00:00
bors
7248d06384 Auto merge of #9471 - jplatte:patch-1, r=xFrednet
Add matches! checking to nonstandard_macro_braces

changelog: Enhancement: [`nonstandard_macro_braces`]: Now includes `matches!()` in the default lint config
  [#9471](https://github.com/rust-lang/rust-clippy/pull/9471)
2022-09-21 12:56:19 +00:00
Oli Scherer
c8ecf09a25 Generalize projection_must_outlive 2022-09-21 12:51:33 +00:00
Oli Scherer
4d4cc4fe53 Generalize a helper to be useful for types other than projections 2022-09-21 12:51:33 +00:00
Oli Scherer
96b819a456 Inline a trivial function 2022-09-21 12:51:33 +00:00
bors
351afbbe1c Auto merge of #2555 - oli-obk:libffi-is-unhappy, r=RalfJung
Only support libffi on unix for now
2022-09-21 12:49:24 +00:00
Oli Scherer
4f357956b8 Only support libffi on unix for now 2022-09-21 12:48:47 +00:00
bors
b79b7d8b4e Auto merge of #101846 - chenyukang:fix-101793, r=davidtwco
Fix the wording of help msg for bitwise not

Fixes #101793
2022-09-21 12:32:54 +00:00
Oli Scherer
e0a2e2d892 Deduplicate two functions that would soon have been three 2022-09-21 12:31:48 +00:00
Guillaume Gomez
b4fdc5861d Add missing documentation for bool::from_str 2022-09-21 14:17:11 +02:00
Oli Scherer
759c04a00b Some tracing instrumentation cleanups 2022-09-21 11:31:55 +00:00
Oli Scherer
3d69d23a25 Split match out into a helper function 2022-09-21 11:31:55 +00:00
bors
cba4a389b3 Auto merge of #101329 - QuinnPainter:armv5te-targets, r=nagisa
Add armv5te-none-eabi and thumbv5te-none-eabi targets

Creates two new Tier 3 targets, `armv5te-none-eabi` and `thumbv5te-none-eabi`. They are for the same target architecture (armv5te), but one defaults to the A32 instruction set and the other defaults to T32. Based on the existing `armv4t-none-eabi` and `thumbv4t-none-eabi` targets.

My particular use case for these targets is Nintendo DS homebrew, but they should be usable for any armv5te system.

Going through the Tier 3 target policy:

> A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.)

That will be me.

> Targets must use naming consistent with any existing targets.

Naming is consistent with previous targets.

>> Target names should not introduce undue confusion or ambiguity unless absolutely necessary to maintain ecosystem compatibility.

No ambiguity here.

> Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users.

Doesn't create any legal issues.

>> The target must not introduce license incompatibilities.

This doesn't introduce any new licenses.

>> Anything added to the Rust repository must be under the standard Rust license (MIT OR Apache-2.0).

Yep.

>> The target must not cause the Rust tools or libraries built for any other host (even when supporting cross-compilation to the target) to depend on any new dependency less permissive than the Rust licensing policy. This applies whether the dependency is a Rust crate that would require adding new license exceptions (as specified by the tidy tool in the rust-lang/rust repository), or whether the dependency is a native library or binary. In other words, the introduction of the target must not cause a user installing or running a version of Rust or the Rust tools to be subject to any new license requirements.

No new license requirements.

>> Compiling, linking, and emitting functional binaries, libraries, or other code for the target (whether hosted on the target itself or cross-compiling from another target) must not depend on proprietary (non-FOSS) libraries.

Everything this uses is FOSS, no proprietary required.

> Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions.

OK.

>> This requirement does not prevent part or all of this policy from being cited in an explicit contract or work agreement (e.g. to implement or maintain support for a target). This requirement exists to ensure that a developer or team responsible for reviewing and approving a target does not face any legal threats or obligations that would prevent them from freely exercising their judgment in such approval, even if such judgment involves subjective matters or goes beyond the letter of these requirements.

OK.

> Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions.

This is a bare-metal target with only support for `core` (and `alloc`, if the user provides an allocator).

> The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible. If the target supports running binaries, or running tests (even if they do not pass), the documentation must explain how to run such binaries or tests for the target, using emulation if possible or dedicated hardware if necessary.

Documentation has been added.

> Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via `@)` to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages.

OK.

> Backlinks such as those generated by the issue/PR tracker when linking to an issue or PR are not considered a violation of this policy, within reason. However, such messages (even on a separate repository) must not generate notifications to anyone involved with a PR who has not requested such notifications.

OK.

> Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target.

This doesn't break any other targets.

>> In particular, this may come up when working on closely related targets, such as variations of the same architecture with different features. Avoid introducing unconditional uses of features that another variation of the target may not have; use conditional compilation or runtime detection, as appropriate, to let each target run code supported by that target.

No unnecessary unconditional features here.
2022-09-21 09:36:21 +00:00
Oli Scherer
369efd0d8e Lint fixes 2022-09-21 09:34:01 +00:00
Oli Scherer
3e6c9e5a19 Fix wrongly refactored Lift impl 2022-09-21 08:29:19 +00:00
bors
3956c9d3fe Auto merge of #9505 - mikerite:fix-9504-2, r=dswij
Fix ICE in `unnecessary_to_owned`

Fixes #9504

Compiler generated call `into_future` nodes return empty substs which we need when checking it's predicates. Handle this by simply exitting when we encounter one. This change introduces false negatives in place of the ICEs.

changelog: [`unnecessary_to_owned`]: fix ICE
2022-09-21 05:53:36 +00:00
Michael Wright
a783d54207 Fix ICE in unnecessary_to_owned
Fixes #9504

Compiler generated call `into_iter` nodes return empty substs
which we need when checking it's predicates. Handle this by
simply exitting when we encounter one. This change introduces
false negatives in place of the ICEs.
2022-09-21 07:14:04 +02:00
bors
1de00d1ac5 Auto merge of #100096 - compiler-errors:fn-return-must-be-sized, r=jackh726
a fn pointer doesn't implement `Fn`/`FnMut`/`FnOnce` if its return type isn't sized

I stumbled upon #83915 which hasn't received much attention recently, and I wanted to revive it since this is one existing soundness hole that seems pretty easy to fix.

I'm not actually sure that the [alternative approach described here](https://github.com/rust-lang/rust/pull/83915#issuecomment-823643322) is sufficient, given the `src/test/ui/function-pointer/unsized-ret.rs` example I provided below. Rebasing the branch mentioned in that comment and testing that UI test, it seems that we actually end up only observing that `str: !Sized` during monomorphization, whereupon we ICE. Even if we were to fix that ICE, ideally we'd be raising an error that a fn pointer is being used badly during _typecheck_ instead of monomorphization, hence adapting the original approach in #83915.

I am happy to close this if people would prefer we rebase the original PR and land that -- I am partly opening to be annoying and get people thinking about this unsoundness again ❤️ 😸

cc: `@estebank` and `@nikomatsakis`
r? types

Here's a link to the thread: https://rust-lang.zulipchat.com/#narrow/stream/144729-t-types/topic/PR.20.2383915/near/235421351 for more context.
2022-09-21 04:35:20 +00:00
Nicholas Nethercote
a7b35b5618 Overhaul -Zmeta-stats output.
It's now much more like the `-Zhir-stats` output.
- Each line is preceded with `meta-stats`, which makes the provenance
  clearer and allows filtering of the output.
- Sections are now sorted in reverse order of size.
- Column headings avoid the need to repeat the word "bytes" on every line.
- Long numbers now have `_` separators for easier reading.
- Consistent use of '-' within section labels, rather than a mix of '-',
  '_', and ' '.

The code itself is shorter and easier to read thanks to:
- the `stat` macro, which encapsulates each section's encoding, avoids
  some boilerplate, and removes the need for some low-value comments;
- the `stats` vector, which replaces dozens of local variables.
2022-09-21 11:22:31 +10:00
Andrew Pollack
324c10e72f Adding needs-unwind for test using panic::catch_unwind 2022-09-21 00:54:23 +00:00
bors
4ecfdfac51 Auto merge of #100214 - scottmcm:strict-range, r=thomcc
Optimize `array::IntoIter`

`.into_iter()` on arrays was slower than it needed to be (especially compared to slice iterator) since it uses `Range<usize>`, which needs to handle degenerate ranges like `10..4`.

This PR adds an internal `IndexRange` type that's like `Range<usize>` but with a safety invariant that means it doesn't need to worry about those cases -- it only handles `start <= end` -- and thus can give LLVM more information to optimize better.

I added one simple demonstration of the improvement as a codegen test.

(`vec::IntoIter` uses pointers instead of indexes, so doesn't have this problem, but that only works because its elements are boxed.  `array::IntoIter` can't use pointers because that would keep it from being movable.)
2022-09-21 00:41:33 +00:00