]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAuto merge of #100881 - Dylan-DPC:rollup-q9rr658, r=Dylan-DPC
bors [Mon, 22 Aug 2022 17:46:57 +0000 (17:46 +0000)]
Auto merge of #100881 - Dylan-DPC:rollup-q9rr658, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #98200 (Expand potential inner `Or` pattern for THIR)
 - #99770 (Make some const prop mir-opt tests `unit-test`s)
 - #99957 (Rework Ipv6Addr::is_global to check for global reachability rather than global scope - rebase)
 - #100331 (Guarantee `try_reserve` preserves the contents on error)
 - #100336 (Fix two const_trait_impl issues)
 - #100713 (Convert diagnostics in parser/expr to SessionDiagnostic)
 - #100820 (Use pointer `is_aligned*` methods)
 - #100872 (Add guarantee that Vec::default() does not alloc)

Failed merges:

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

2 years agoRollup merge of #100872 - JanBeh:PR_vec_default_alloc_doc, r=fee1-dead
Dylan DPC [Mon, 22 Aug 2022 15:04:16 +0000 (20:34 +0530)]
Rollup merge of #100872 - JanBeh:PR_vec_default_alloc_doc, r=fee1-dead

Add guarantee that Vec::default() does not alloc

Currently `Vec::new()` is guaranteed to not allocate until elements are pushed onto the `Vec`, but such a guarantee is missing for `Vec`'s implementation of `Default::default`.

This adds such a guarantee for `Vec::default()` to the API reference.

See also [this discussion on URLO](https://users.rust-lang.org/t/guarantee-that-vec-default-does-not-allocate/79903).

2 years agoRollup merge of #100820 - WaffleLapkin:use_ptr_is_aligned_methods, r=scottmcm
Dylan DPC [Mon, 22 Aug 2022 15:04:15 +0000 (20:34 +0530)]
Rollup merge of #100820 - WaffleLapkin:use_ptr_is_aligned_methods, r=scottmcm

Use pointer `is_aligned*` methods

This PR replaces some manual alignment checks with calls to `pointer::{is_aligned, is_aligned_to}` and removes a useless pointer cast.

r? `@scottmcm`

_split off from #100746_

2 years agoRollup merge of #100713 - Xiretza:parser-expr-session-diagnostics, r=estebank
Dylan DPC [Mon, 22 Aug 2022 15:04:14 +0000 (20:34 +0530)]
Rollup merge of #100713 - Xiretza:parser-expr-session-diagnostics, r=estebank

Convert diagnostics in parser/expr to SessionDiagnostic

This migrates all the easy cases in `rustc_parse::parser::expr` to `SessionDiagnostic`s, I've left things such as `multipart_suggestion`s out for now in the hopes of a derive API being developed soon.

2 years agoRollup merge of #100336 - fee1-dead-contrib:fix-wf-const-trait, r=oli-obk
Dylan DPC [Mon, 22 Aug 2022 15:04:13 +0000 (20:34 +0530)]
Rollup merge of #100336 - fee1-dead-contrib:fix-wf-const-trait, r=oli-obk

Fix two const_trait_impl issues

r? ``@oli-obk``

Fixes #100222.
Fixes #100543.

2 years agoRollup merge of #100331 - lo48576:try-reserve-preserve-on-failure, r=thomcc
Dylan DPC [Mon, 22 Aug 2022 15:04:12 +0000 (20:34 +0530)]
Rollup merge of #100331 - lo48576:try-reserve-preserve-on-failure, r=thomcc

Guarantee `try_reserve` preserves the contents on error

Update doc comments to make the guarantee explicit. However, some
implementations does not have the statement though.

* `HashMap`, `HashSet`: require guarantees on hashbrown side.
* `PathBuf`: simply redirecting to `OsString`.

Fixes #99606.

2 years agoRollup merge of #99957 - chotchki:ip-globally-reachable_rebase, r=Mark-Simulacrum
Dylan DPC [Mon, 22 Aug 2022 15:04:10 +0000 (20:34 +0530)]
Rollup merge of #99957 - chotchki:ip-globally-reachable_rebase, r=Mark-Simulacrum

Rework Ipv6Addr::is_global to check for global reachability rather than global scope - rebase

Rebasing of pull request #86634 off of master to try and get the feature "ip" stabilized.

I also found a test failure in the rebase that is_global was considering the benchmark space to be globally reachable.

This is related to my other rebasing pull request #99947

2 years agoRollup merge of #99770 - Nilstrieb:mir-pass-unit-test, r=oli-obk
Dylan DPC [Mon, 22 Aug 2022 15:04:09 +0000 (20:34 +0530)]
Rollup merge of #99770 - Nilstrieb:mir-pass-unit-test, r=oli-obk

Make some const prop mir-opt tests `unit-test`s

Most of these have no or only tiny diffs beyond line numbers being changed (would it make sense to not have line numbers in mir-opt tests?). Some things changed a bit, but I think it should all be fine, not sure though.

2 years agoRollup merge of #98200 - ouz-a:issue-98177, r=oli-obk
Dylan DPC [Mon, 22 Aug 2022 15:04:08 +0000 (20:34 +0530)]
Rollup merge of #98200 - ouz-a:issue-98177, r=oli-obk

Expand potential inner `Or` pattern for THIR

Code assumed there wouldn't be a deeper `Or` pattern inside expanded `PatStack` this fixes it by looking for the `Or` pattern inside expanded `PatStack`.

A more ideal solution would be recursively doing this but I haven't found a good way to do that.
_fixes #97898_

2 years agoAuto merge of #99908 - Nilstrieb:mir-opt-span, r=oli-obk
bors [Mon, 22 Aug 2022 14:59:21 +0000 (14:59 +0000)]
Auto merge of #99908 - Nilstrieb:mir-opt-span, r=oli-obk

Show absolute line numbers if span is outside relative span

In the MIR pretty printing, it can sometimes happen that the span of the statement is outside the span of the body (for example through inlining). In this case, don't display a relative span but an absolute span. This will make the mir-opt-tests a little more prone to diffs again, but the impact should be small.

Fixes #99854

r? `@oli-obk`

2 years agobless mir-opt tests
Nilstrieb [Fri, 29 Jul 2022 16:52:38 +0000 (18:52 +0200)]
bless mir-opt tests

2 years agobless ui tests
Nilstrieb [Fri, 29 Jul 2022 16:52:04 +0000 (18:52 +0200)]
bless ui tests

2 years agoFix span for consts in mir builder
Nilstrieb [Fri, 29 Jul 2022 16:49:27 +0000 (18:49 +0200)]
Fix span for consts in mir builder

2 years agoShow absolute line numbers if span is outside relative span
Nilstrieb [Fri, 29 Jul 2022 14:34:06 +0000 (16:34 +0200)]
Show absolute line numbers if span is outside relative span

In the MIR pretty printing, it can sometimes happen that the span of the
statement is outside the span of the body (for example through
inlining). In this case, don't display a relative span but an absolute
span. This will make the mir-opt-tests a little more prone to diffs
again, but the impact should be small.

2 years agofix tidy
Deadbeef [Mon, 22 Aug 2022 11:41:38 +0000 (11:41 +0000)]
fix tidy

2 years agoAuto merge of #99702 - SparrowLii:transtive_relation, r=oli-obk
bors [Mon, 22 Aug 2022 11:39:53 +0000 (11:39 +0000)]
Auto merge of #99702 - SparrowLii:transtive_relation, r=oli-obk

get rid of `RefCell` in `TransitiveRelation`

This is one of the jobs in `Pending refactorings` in #48685. The parallel-compiler's work has been suspended for quite some time, but I think I can pick it up gradually. I think this PR should be a start.

Regarding the refactoring of `TransitiveRelation`, `@nikomatsakis`  has proposed [two(three?) schemes](https://github.com/rust-lang/rust/pull/48587#issuecomment-369336651). In order to satisfy both compilation efficiency and robustness, I think adding the `freeze` method may be the best solution, although it requires relatively more code changes.

2 years agoOverhaul 100222 test; wf always remap to nonconst
Deadbeef [Mon, 22 Aug 2022 11:28:01 +0000 (11:28 +0000)]
Overhaul 100222 test; wf always remap to nonconst

2 years agoremove stray comment
Deadbeef [Mon, 22 Aug 2022 11:06:07 +0000 (11:06 +0000)]
remove stray comment

2 years agoFix wf check on `#[const_trait]` return types
Deadbeef [Tue, 9 Aug 2022 17:41:49 +0000 (17:41 +0000)]
Fix wf check on `#[const_trait]` return types

2 years agoAdd guarantee that Vec::default() does not alloc
Jan Behrens [Mon, 22 Aug 2022 10:36:44 +0000 (12:36 +0200)]
Add guarantee that Vec::default() does not alloc

Currently `Vec::new()` is guaranteed to not allocate until elements are
pushed onto the `Vec`, but such a guarantee is missing for `Vec`'s
implementation of `Default::default`. This adds such a guarantee for
`Vec::default()` to the API reference.

2 years agore-base and use `OutlivesEnvironment::with_bounds`
SparrowLii [Mon, 22 Aug 2022 10:36:02 +0000 (18:36 +0800)]
re-base and use `OutlivesEnvironment::with_bounds`

2 years agouse type alias impl trait in `outlives_bounds::InferCtxtExt`
SparrowLii [Mon, 1 Aug 2022 02:23:09 +0000 (10:23 +0800)]
use type alias impl trait in `outlives_bounds::InferCtxtExt`

2 years agoadd `with_bounds` to `OutlivesEnvironment` and `implied_bounds_tys` to `outlives_boun...
SparrowLii [Fri, 29 Jul 2022 07:08:50 +0000 (15:08 +0800)]
add `with_bounds` to `OutlivesEnvironment` and `implied_bounds_tys` to `outlives_bounds::InferCtxtExt`

2 years agoget rid of `RefCell` in `TransitiveRelation`
SparrowLii [Mon, 25 Jul 2022 03:06:22 +0000 (11:06 +0800)]
get rid of `RefCell` in `TransitiveRelation`

2 years agoAuto merge of #100868 - Dylan-DPC:rollup-a1hfi1r, r=Dylan-DPC
bors [Mon, 22 Aug 2022 08:32:41 +0000 (08:32 +0000)]
Auto merge of #100868 - Dylan-DPC:rollup-a1hfi1r, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #93162 (Std module docs improvements)
 - #99386 (Add tests that check `Vec::retain` predicate execution order.)
 - #99915 (Recover keywords in trait bounds)
 - #100694 (Migrate rustc_ast_passes diagnostics to `SessionDiagnostic` and translatable messages (first part))
 - #100757 (Catch overflow early)

Failed merges:

 - #99917 (Move Error trait into core)

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

2 years agoRollup merge of #100757 - ouz-a:issue-95134, r=jackh726
Dylan DPC [Mon, 22 Aug 2022 06:15:45 +0000 (11:45 +0530)]
Rollup merge of #100757 - ouz-a:issue-95134, r=jackh726

Catch overflow early

Although this code should raise an overflow error, it didn't because [check_recursion_limit](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_trait_selection/traits/select/struct.SelectionContext.html#method.check_recursion_limit) it checks for `depth = 128` but not for `129` which should have triggered the overflow error. Anyways this catches that error early.

Fixes #95134

2 years agoRollup merge of #100694 - finalchild:ast-passes-diag, r=TaKO8Ki
Dylan DPC [Mon, 22 Aug 2022 06:15:44 +0000 (11:45 +0530)]
Rollup merge of #100694 - finalchild:ast-passes-diag, r=TaKO8Ki

Migrate rustc_ast_passes diagnostics to `SessionDiagnostic` and translatable messages (first part)

Doing a full migration of the `rustc_ast_passes` crate.
Making a draft here since there's not yet a tracking issue for the migrations going on.

`@rustbot` label +A-translation

2 years agoRollup merge of #99915 - WaffleLapkin:recover_keyword_bounds, r=compiler-errors
Dylan DPC [Mon, 22 Aug 2022 06:15:42 +0000 (11:45 +0530)]
Rollup merge of #99915 - WaffleLapkin:recover_keyword_bounds, r=compiler-errors

Recover keywords in trait bounds

(_this pr was inspired by [this tweet](https://twitter.com/Azumanga/status/1552982326409367561)_)

Recover keywords in trait bound, motivational example:
```rust
fn f(_: impl fn()) {} // mistyped, meant `Fn`
```

<details><summary>Current nightly (3 needless and confusing errors!)</summary>
<p>

```text
error: expected identifier, found keyword `fn`
 --> ./t.rs:1:15
  |
1 | fn _f(_: impl fn()) {}
  |               ^^ expected identifier, found keyword
  |
help: escape `fn` to use it as an identifier
  |
1 | fn _f(_: impl r#fn()) {}
  |               ++

error: expected one of `:` or `|`, found `)`
 --> ./t.rs:1:19
  |
1 | fn _f(_: impl fn()) {}
  |                   ^ expected one of `:` or `|`

error: expected one of `!`, `(`, `)`, `,`, `?`, `for`, `~`, lifetime, or path, found keyword `fn`
 --> ./t.rs:1:15
  |
1 | fn _f(_: impl fn()) {}
  |              -^^ expected one of 9 possible tokens
  |              |
  |              help: missing `,`

error: at least one trait must be specified
 --> ./t.rs:1:10
  |
1 | fn _f(_: impl fn()) {}
  |          ^^^^
```

</p>
</details>

This PR:
```text
error: expected identifier, found keyword `fn`
 --> ./t.rs:1:15
  |
1 | fn _f(_: impl fn()) {}
  |               ^^ expected identifier, found keyword
  |
help: escape `fn` to use it as an identifier
  |
1 | fn _f(_: impl r#fn()) {}
  |               ++

error[E0405]: cannot find trait `r#fn` in this scope
  --> ./t.rs:1:15
   |
1  | fn _f(_: impl fn()) {}
   |               ^^ help: a trait with a similar name exists (notice the capitalization): `Fn`
   |
  ::: /home/waffle/projects/repos/rust/library/core/src/ops/function.rs:74:1
   |
74 | pub trait Fn<Args>: FnMut<Args> {
   | ------------------------------- similarly named trait `Fn` defined here
```

It would be nice to have suggestion in the first error like "have you meant `Fn` trait", instead of a separate error, but the recovery is deep inside ident parsing, which makes it a lot harder to do.

r? `@compiler-errors`

2 years agoRollup merge of #99386 - AngelicosPhosphoros:add_retain_test_maybeuninit, r=JohnTitor
Dylan DPC [Mon, 22 Aug 2022 06:15:41 +0000 (11:45 +0530)]
Rollup merge of #99386 - AngelicosPhosphoros:add_retain_test_maybeuninit, r=JohnTitor

Add tests that check `Vec::retain` predicate execution order.

This behaviour is documented for `Vec::retain` which means that there is code that rely on that but there weren't tests about that.

2 years agoRollup merge of #93162 - camsteffen:std-prim-docs, r=Mark-Simulacrum
Dylan DPC [Mon, 22 Aug 2022 06:15:40 +0000 (11:45 +0530)]
Rollup merge of #93162 - camsteffen:std-prim-docs, r=Mark-Simulacrum

Std module docs improvements

My primary goal is to create a cleaner separation between primitive types and primitive type helper modules (fixes #92777). I also changed a few header lines in other top-level std modules (seen at https://doc.rust-lang.org/std/) for consistency.

Some conventions used/established:

 * "The \`Box\<T>` type for heap allocation." - if a module mainly provides a single type, name it and summarize its purpose in the module header
 * "Utilities for the _ primitive type." - this wording is used for the header of helper modules
 * Documentation for primitive types themselves are removed from helper modules
 * provided-by-core functionality of primitive types is documented in the primitive type instead of the helper module (such as the "Iteration" section in the slice docs)

I wonder if some content in `std::ptr` should be in `pointer` but I did not address this.

2 years agoAuto merge of #100676 - lcnr:implied-bounds-yay, r=nikomatsakis
bors [Mon, 22 Aug 2022 06:10:26 +0000 (06:10 +0000)]
Auto merge of #100676 - lcnr:implied-bounds-yay, r=nikomatsakis

implied bounds: explicitly state which types are assumed to be wf

Adds a new query which maps each definition to the types which that definition assumes to be well formed. The intent is to make it easier to reason about implied bounds.

This change should not influence the user-facing behavior of rustc. Notably, `borrowck` still only assumes that the function signature of associated functions is well formed while `wfcheck` assumes that the both the function signature and the impl trait ref is well formed. Not sure if that by itself can trigger UB or whether it's just annoying.

As a next step, we can add `WellFormed` predicates to `predicates_of` of these items and can stop adding the wf bounds at each place which uses them. I also intend to move the computation from `assumed_wf_types` to `implied_bounds` into the `param_env` computation. This requires me to take a deeper look at `compare_predicate_entailment` which is currently somewhat weird wrt implied bounds so I am not touching this here.

r? `@nikomatsakis`

2 years agoAuto merge of #100671 - Xiretza:tidy-fluent-files, r=davidtwco
bors [Mon, 22 Aug 2022 03:02:50 +0000 (03:02 +0000)]
Auto merge of #100671 - Xiretza:tidy-fluent-files, r=davidtwco

tidy: check fluent files for style

Inspired by https://github.com/rust-lang/rust/pull/100651#discussion_r947600576

There were a lot of line length violations, so I've excepted that lint - I'm not sure if fluent files can be formatted to avoid long lines at all.

2 years agoAuto merge of #100668 - nnethercote:use-AttrVec-more, r=spastorino
bors [Mon, 22 Aug 2022 00:34:02 +0000 (00:34 +0000)]
Auto merge of #100668 - nnethercote:use-AttrVec-more, r=spastorino

Use `AttrVec` more

In some places we use `Vec<Attribute>` and some places we use
`ThinVec<Attribute>` (a.k.a. `AttrVec`). This results in various points
where we have to convert between `Vec` and `ThinVec`.

This commit changes the places that use `Vec<Attribute>` to use
`AttrVec`. A lot of this is mechanical and boring, but there are
some interesting parts:
- It adds a few new methods to `ThinVec`.
- It implements `MapInPlace` for `ThinVec`, and introduces a macro to
  avoid the repetition of this trait for `Vec`, `SmallVec`, and
  `ThinVec`.

Overall, it makes the code a little nicer, and has little effect on
performance. But it is a precursor to removing
`rustc_data_structures::ThinVec` and replacing it with
`thin_vec::ThinVec`, which is implemented more efficiently.

r? `@spastorino`

2 years agoAuto merge of #100654 - compiler-errors:rework-point-at-arg, r=estebank
bors [Sun, 21 Aug 2022 21:52:56 +0000 (21:52 +0000)]
Auto merge of #100654 - compiler-errors:rework-point-at-arg, r=estebank

Rework "point at arg" suggestions to be more accurate

Fixes #100560

Introduce a new set of `ObligationCauseCode`s which have additional bookeeping for what expression caused the obligation, and which predicate caused the obligation. This allows us to look at the _unsubstituted_ signature to find out which parameter or generic type argument caused an obligaton to fail.

This means that (in most cases) we significantly improve the likelihood of pointing out the right argument that causes a fulfillment error. Also, since this logic isn't happening in just the `select_where_possible_and_mutate_fulfillment()` calls in the argument checking code, but instead during all trait selection in `FnCtxt`, we are also able to point out the correct argument even if inference means that we don't know whether an obligation has failed until well after a call expression has been checked.

r? `@ghost`

2 years agoUse `AttrVec` in more places.
Nicholas Nethercote [Wed, 17 Aug 2022 02:34:33 +0000 (12:34 +1000)]
Use `AttrVec` in more places.

In some places we use `Vec<Attribute>` and some places we use
`ThinVec<Attribute>` (a.k.a. `AttrVec`). This results in various points
where we have to convert between `Vec` and `ThinVec`.

This commit changes the places that use `Vec<Attribute>` to use
`AttrVec`. A lot of this is mechanical and boring, but there are
some interesting parts:
- It adds a few new methods to `ThinVec`.
- It implements `MapInPlace` for `ThinVec`, and introduces a macro to
  avoid the repetition of this trait for `Vec`, `SmallVec`, and
  `ThinVec`.

Overall, it makes the code a little nicer, and has little effect on
performance. But it is a precursor to removing
`rustc_data_structures::thin_vec::ThinVec` and replacing it with
`thin_vec::ThinVec`, which is implemented more efficiently.

2 years agoAuto merge of #100847 - matthiaskrgr:rollup-0ga531s, r=matthiaskrgr
bors [Sun, 21 Aug 2022 19:05:18 +0000 (19:05 +0000)]
Auto merge of #100847 - matthiaskrgr:rollup-0ga531s, r=matthiaskrgr

Rollup of 11 pull requests

Successful merges:

 - #100556 (Clamp Function for f32 and f64)
 - #100663 (Make slice::reverse const)
 - #100697 ( Minor syntax and formatting update to doc comment on `find_vtable_types_for_unsizing`)
 - #100760 (update test for LLVM change)
 - #100761 (some general mir typeck cleanup)
 - #100775 (rustdoc: Merge source code pages HTML elements together v2)
 - #100813 (Add `/build-rust-analyzer/` to .gitignore)
 - #100821 (Make some docs nicer wrt pointer offsets)
 - #100822 (Replace most uses of `pointer::offset` with `add` and `sub`)
 - #100839 (Make doc for stdin field of process consistent)
 - #100842 (Add diagnostics lints to `rustc_transmute` module (zero diags))

Failed merges:

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

2 years agoAuto merge of #100645 - notriddle:notriddle/rustdoc-diet-plan, r=GuillaumeGomez
bors [Sun, 21 Aug 2022 16:40:26 +0000 (16:40 +0000)]
Auto merge of #100645 - notriddle:notriddle/rustdoc-diet-plan, r=GuillaumeGomez

rustdoc: strategic boxing to reduce the size of ItemKind and Type

The `Type` change redesigns `QPath` to box the entire data structure instead of boxing `self_type` and the `trait_`.

This reduces the size of several `ItemKind` variants, leaving `Impl` as the biggest variant. The `ItemKind` change boxes that variant's payload.

2 years agoReplace #[error(..)] etc. to #[diag(..)]
finalchild [Sun, 21 Aug 2022 16:24:47 +0000 (01:24 +0900)]
Replace #[error(..)] etc. to #[diag(..)]

2 years agoFix incorrect return type of emit_fatal
Park Jaeon [파차] [Sat, 20 Aug 2022 17:22:05 +0000 (02:22 +0900)]
Fix incorrect return type of emit_fatal

Co-authored-by: Giacomo Stevanato <giaco.stevanato@gmail.com>
2 years agoRemove redundant clone
finalchild [Thu, 18 Aug 2022 18:36:43 +0000 (03:36 +0900)]
Remove redundant clone

2 years agoMigrate forbidden_default and *_without_body
finalchild [Thu, 18 Aug 2022 17:43:01 +0000 (02:43 +0900)]
Migrate forbidden_default and *_without_body

2 years agoFix `build_format` not unescaping braces properly
finalchild [Thu, 18 Aug 2022 17:21:35 +0000 (02:21 +0900)]
Fix `build_format` not unescaping braces properly

Co-authored-by: RanolP <public.ranolp@gmail.com>
2 years agoSupport #[fatal(..)]
finalchild [Thu, 18 Aug 2022 12:20:50 +0000 (21:20 +0900)]
Support #[fatal(..)]

2 years agoMigrate fn_param_forbidden_self and rename others to have prefix fn_param_
finalchild [Thu, 18 Aug 2022 09:20:14 +0000 (18:20 +0900)]
Migrate fn_param_forbidden_self and rename others to have prefix fn_param_

2 years agoRename c_var_args_without_named_arg to c_var_args_is_sole_param
finalchild [Thu, 18 Aug 2022 08:53:59 +0000 (17:53 +0900)]
Rename c_var_args_without_named_arg to c_var_args_is_sole_param

2 years agoMigrate doc_comment_on_fn_param, forbidden_attr_on_fn_param
finalchild [Thu, 18 Aug 2022 08:46:01 +0000 (17:46 +0900)]
Migrate doc_comment_on_fn_param, forbidden_attr_on_fn_param

2 years agoMigrate forbidden_lifetime_bound, forbidden_non_lifetime_param, too_many_params,...
finalchild [Thu, 18 Aug 2022 08:38:11 +0000 (17:38 +0900)]
Migrate forbidden_lifetime_bound, forbidden_non_lifetime_param, too_many_params, c_var_args_without_named_arg, c_var_args_not_last

2 years agoMigrate trait_fn_const
finalchild [Thu, 18 Aug 2022 07:57:25 +0000 (16:57 +0900)]
Migrate trait_fn_const

2 years agoMigrate trait_fn_async
finalchild [Thu, 18 Aug 2022 07:49:52 +0000 (16:49 +0900)]
Migrate trait_fn_async

2 years agoTidy
finalchild [Thu, 18 Aug 2022 06:23:00 +0000 (15:23 +0900)]
Tidy

2 years agoMigrate deprecated_where_clause_location, forbidden_assoc_constraint, keyword_lifetim...
finalchild [Wed, 17 Aug 2022 19:36:57 +0000 (04:36 +0900)]
Migrate deprecated_where_clause_location, forbidden_assoc_constraint, keyword_lifetime, invalid_label, invalid_visibility

2 years agoUse DiagnosticMessage for BufferedEarlyLint.msg
finalchild [Wed, 17 Aug 2022 14:52:16 +0000 (23:52 +0900)]
Use DiagnosticMessage for BufferedEarlyLint.msg

2 years agoMigrate forbidden_let
finalchild [Wed, 17 Aug 2022 14:51:01 +0000 (23:51 +0900)]
Migrate forbidden_let

2 years agoRollup merge of #100842 - JhonnyBillM:enable-diag-lint-in-transmute, r=TaKO8Ki
Matthias Krüger [Sun, 21 Aug 2022 14:54:09 +0000 (16:54 +0200)]
Rollup merge of #100842 - JhonnyBillM:enable-diag-lint-in-transmute, r=TaKO8Ki

Add diagnostics lints to `rustc_transmute` module (zero diags)

Module is complete because it has zero diagnostics.

2 years agoRollup merge of #100839 - nelsonjchen:consistent_child_stdin_field_desc, r=thomcc
Matthias Krüger [Sun, 21 Aug 2022 14:54:08 +0000 (16:54 +0200)]
Rollup merge of #100839 - nelsonjchen:consistent_child_stdin_field_desc, r=thomcc

Make doc for stdin field of process consistent

The other fields use this format and example.

2 years agoRollup merge of #100822 - WaffleLapkin:no_offset_question_mark, r=scottmcm
Matthias Krüger [Sun, 21 Aug 2022 14:54:07 +0000 (16:54 +0200)]
Rollup merge of #100822 - WaffleLapkin:no_offset_question_mark, r=scottmcm

Replace most uses of `pointer::offset` with `add` and `sub`

As PR title says, it replaces `pointer::offset` in compiler and standard library with `pointer::add` and `pointer::sub`. This generally makes code cleaner, easier to grasp and removes (or, well, hides) integer casts.

This is generally trivially correct, `.offset(-constant)` is just `.sub(constant)`, `.offset(usized as isize)` is just `.add(usized)`, etc. However in some cases we need to be careful with signs of things.

r? ````@scottmcm````

_split off from #100746_

2 years agoRollup merge of #100821 - WaffleLapkin:ptr_add_docs, r=scottmcm
Matthias Krüger [Sun, 21 Aug 2022 14:54:06 +0000 (16:54 +0200)]
Rollup merge of #100821 - WaffleLapkin:ptr_add_docs, r=scottmcm

Make some docs nicer wrt pointer offsets

This PR replaces `pointer::offset` with `pointer::add` and similarly `.cast().wrapping_add().cast()` with `.wrapping_byte_add()` **in docs**.

r? ``````@scottmcm``````

_split off from #100746_

2 years agoRollup merge of #100813 - Nilstrieb:too-much-disk-space-gitignore, r=Mark-Simulacrum
Matthias Krüger [Sun, 21 Aug 2022 14:54:05 +0000 (16:54 +0200)]
Rollup merge of #100813 - Nilstrieb:too-much-disk-space-gitignore, r=Mark-Simulacrum

Add `/build-rust-analyzer/` to .gitignore

To avoid rust-analyzer and rustc having to wait for each other, the [dev guide](https://rustc-dev-guide.rust-lang.org/building/suggested.html#configuring-rust-analyzer-for-rustc) mentions using another build directory for RA.

We should also put this into the .gitignore, just like the normal `build`.

2 years agoRollup merge of #100775 - GuillaumeGomez:reduce-span-v2, r=notriddle
Matthias Krüger [Sun, 21 Aug 2022 14:54:04 +0000 (16:54 +0200)]
Rollup merge of #100775 - GuillaumeGomez:reduce-span-v2, r=notriddle

rustdoc: Merge source code pages HTML elements together v2

This is the follow-up of https://github.com/rust-lang/rust/pull/100429.

I strongly recommend to review it one commit at a time because otherwise it's a lot at once.

For these ones, on each page, I run this JS: `document.getElementsByTagName('*').length`. The goal is to count the number of DOM elements. I took some pages that seemed big, but don't hesitate to check some others. I also added the "starting point" because it's quite nice to see how much the page was reduced thanks to these two PRs.

| file name | before #100429 | before this PR | with this PR | diff |
|-|-|-|-|-|
| std/lib.rs.html (source link on std crate page) | 3455 | 2332 | 1772 | 24% |
| alloc/vec/mod.rs.html (source on Vec type page) | 11012 | 5982 | 5833 | 2.5% |
| alloc/string.rs.html (source on String type page) | 10800 | 6010 | 5822 | 3.2% |
| std/sync/mutex.rs.html (source on Mutex type page) | 2953 | 2041 | 2038 | 0.1% |

So unsurprisingly, the more attributes you have, the bigger the difference.

You can test it [here](https://rustdoc.crud.net/imperio/reduce-span-v2/src/std/lib.rs.html).

cc ``````@jsha``````
r? ``````@notriddle``````

2 years agoRollup merge of #100761 - lcnr:mir-typeck-cleanup, r=compiler-errors
Matthias Krüger [Sun, 21 Aug 2022 14:54:04 +0000 (16:54 +0200)]
Rollup merge of #100761 - lcnr:mir-typeck-cleanup, r=compiler-errors

some general mir typeck cleanup

this pr contains the parts of #95763 which already work correctly.

the remaining commits of that PR have some issues which are more complex to fix.

r? types

2 years agoRollup merge of #100760 - krasimirgg:llvm-16-pic-level, r=nikic
Matthias Krüger [Sun, 21 Aug 2022 14:54:03 +0000 (16:54 +0200)]
Rollup merge of #100760 - krasimirgg:llvm-16-pic-level, r=nikic

update test for LLVM change

LLVM commit https://github.com/llvm/llvm-project/commit/c2a38887932e3a46aa3bee35f3f5568ac68282f4 updates the PIC level version selection. Updated an affected rust test to work under both the old and new behaviors.

Detected by our experimental rust + llvm @ HEAD bot:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/12829#0182b368-a405-47a2-b3da-9c79cb907bfe/701-709

2 years agoRollup merge of #100697 - eholk:doc-comment-update, r=compiler-errors
Matthias Krüger [Sun, 21 Aug 2022 14:54:02 +0000 (16:54 +0200)]
Rollup merge of #100697 - eholk:doc-comment-update, r=compiler-errors

 Minor syntax and formatting update to doc comment on `find_vtable_types_for_unsizing`

I noticed the code examples on this function weren't formatted as code, and also the that the syntax for trait objects was out of date (or just incorrect). This should bring it up to date.

2 years agoRollup merge of #100663 - clarfonthey:const-reverse, r=scottmcm
Matthias Krüger [Sun, 21 Aug 2022 14:54:01 +0000 (16:54 +0200)]
Rollup merge of #100663 - clarfonthey:const-reverse, r=scottmcm

Make slice::reverse const

I remember this not being doable for some reason before, but decided to try it again and everything worked out in the tests.

2 years agoRollup merge of #100556 - Alex-Velez:patch-1, r=scottmcm
Matthias Krüger [Sun, 21 Aug 2022 14:54:01 +0000 (16:54 +0200)]
Rollup merge of #100556 - Alex-Velez:patch-1, r=scottmcm

Clamp Function for f32 and f64

I thought the clamp function could use a little improvement for readability purposes. The function now returns early in order to skip the extra bound checks.

If there was a reason for binding `self` to `x` or if this code is incorrect, please correct me :)

2 years agoAuto merge of #100841 - RalfJung:miri, r=RalfJung
bors [Sun, 21 Aug 2022 13:54:06 +0000 (13:54 +0000)]
Auto merge of #100841 - RalfJung:miri, r=RalfJung

update Miri

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

2 years agoADD - diagnostic lints to rustc_transmute
Jhonny Bill Mena [Sun, 21 Aug 2022 13:17:09 +0000 (09:17 -0400)]
ADD - diagnostic lints to rustc_transmute

Module is complete because it has zero diagnostics.

2 years agoupdate Miri
Ralf Jung [Sun, 21 Aug 2022 12:57:07 +0000 (08:57 -0400)]
update Miri

2 years agoMigrate diagnostics in parser/expr to SessionDiagnostic
Xiretza [Wed, 17 Aug 2022 17:05:49 +0000 (19:05 +0200)]
Migrate diagnostics in parser/expr to SessionDiagnostic

2 years agoMake use of `pointer::is_aligned[_to]`
Maybe Waffle [Fri, 19 Aug 2022 09:26:37 +0000 (13:26 +0400)]
Make use of `pointer::is_aligned[_to]`

2 years agorecover `const Tr` bounds (no `~`)
Maybe Waffle [Sun, 21 Aug 2022 10:58:42 +0000 (14:58 +0400)]
recover `const Tr` bounds (no `~`)

2 years agoAuto merge of #100765 - Xiretza:session-diagnostic-unification, r=compiler-errors
bors [Sun, 21 Aug 2022 10:04:42 +0000 (10:04 +0000)]
Auto merge of #100765 - Xiretza:session-diagnostic-unification, r=compiler-errors

Kind-less SessionDiagnostic derive

From https://github.com/rust-lang/rust/pull/100730#discussion_r949712629:

> Hm, maybe we should expose some `sess.struct_$SOMETHING` (like `struct_diagnostic`?) that is generic over `EmissionGuarantee`, then make the `SessionDiagnostic` derive generic, i.e.
>
> ```rust
> impl<'tcx> SessionDiagnostic for UnusedGenericParams {
>   fn into_diagnostic<T: EmissionGuarantee>( .. ) -> DiagnosticBuilder<'tcx, T> {
>     let mut diag = sess.struct_diagnostic(rustc_errors:..);
>     ..
>   }
> }
> ```

Discussed [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/.23100717.20translation.20-.20kind-less.20derive).

2 years agoMake doc for stdin field of process consistent
Nelson Chen [Sun, 21 Aug 2022 08:56:26 +0000 (01:56 -0700)]
Make doc for stdin field of process consistent

The other fields use this format and example.

2 years agoAuto merge of #100627 - krasimirgg:lto-llvm-16, r=cuviper
bors [Sun, 21 Aug 2022 07:19:49 +0000 (07:19 +0000)]
Auto merge of #100627 - krasimirgg:lto-llvm-16, r=cuviper

llvm-wrapper: adapt for LLVM API change

No functional changes intended.

LLVM commit https://github.com/llvm/llvm-project/commit/633f5663c37a670e28040cadd938200abd854483 removed `createWriteThinLTOBitcodePass`.
This adapts PassWrapper similarly to the example mentioned upstream: https://github.com/llvm/llvm-project/commit/853b57fe80bdb9d6b19697e6f2abc734834e9f6d.

Detected via our experimental rust + llvm @ head bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/12768#0182a6be-ed6e-4dc6-a230-7a46f9d3a2c2/205-537

2 years agoReplace #[lint/warning/error] with #[diag]
Xiretza [Fri, 19 Aug 2022 13:40:48 +0000 (15:40 +0200)]
Replace #[lint/warning/error] with #[diag]

2 years agoDisallow #[primary_span] on LintDiagnostics
Xiretza [Fri, 19 Aug 2022 13:04:34 +0000 (15:04 +0200)]
Disallow #[primary_span] on LintDiagnostics

2 years agoMake derived SessionDiagnostics generic on diagnostic level
Xiretza [Fri, 19 Aug 2022 13:02:10 +0000 (15:02 +0200)]
Make derived SessionDiagnostics generic on diagnostic level

Deriving SessionDiagnostic on a type no longer forces that diagnostic to
be one of warning, error, or fatal. The level is instead decided when
the struct is passed to the respective Handler::emit_*() method.

2 years agoAdd Handler::struct_diagnostic()
Xiretza [Fri, 19 Aug 2022 12:47:45 +0000 (14:47 +0200)]
Add Handler::struct_diagnostic()

This unifies the struct_{warn,error,fatal}() methods in one generic
method.

2 years agoAuto merge of #100624 - GuillaumeGomez:update-minifier-version, r=nnethercote
bors [Sun, 21 Aug 2022 04:21:06 +0000 (04:21 +0000)]
Auto merge of #100624 - GuillaumeGomez:update-minifier-version, r=nnethercote

Update minifier version to 0.2.2

Following [this PR](https://github.com/GuillaumeGomez/minifier-rs/pull/98), the CSS minification should be much faster now (thanks to `@nnethercote).`

r? `@nnethercote`

2 years agoBless tests after #100769
Michael Goulet [Sun, 21 Aug 2022 03:52:08 +0000 (03:52 +0000)]
Bless tests after #100769

2 years agofix nitpicks from review
Maybe Waffle [Sun, 21 Aug 2022 02:36:11 +0000 (06:36 +0400)]
fix nitpicks from review

2 years agoMake check for overlapping closure span more accurate
Michael Goulet [Thu, 18 Aug 2022 13:27:08 +0000 (13:27 +0000)]
Make check for overlapping closure span more accurate

2 years agoAdjust messages, address some nits
Michael Goulet [Thu, 18 Aug 2022 12:16:35 +0000 (12:16 +0000)]
Adjust messages, address some nits

2 years agoMore docs
Michael Goulet [Wed, 17 Aug 2022 16:20:22 +0000 (16:20 +0000)]
More docs

2 years agoTargeted fixes addressing erroneous suggestions
Michael Goulet [Wed, 17 Aug 2022 06:48:09 +0000 (06:48 +0000)]
Targeted fixes addressing erroneous suggestions

2 years agoComment a bit, use find_ancestor_in_same_ctxt to suppress some weird macro notes
Michael Goulet [Wed, 17 Aug 2022 06:17:36 +0000 (06:17 +0000)]
Comment a bit, use find_ancestor_in_same_ctxt to suppress some weird macro notes

2 years agoPoint at struct field if possible
Michael Goulet [Wed, 17 Aug 2022 04:57:17 +0000 (04:57 +0000)]
Point at struct field if possible

2 years agoDeduplicate errors that come from places like normalization, sized
Michael Goulet [Wed, 17 Aug 2022 02:22:06 +0000 (02:22 +0000)]
Deduplicate errors that come from places like normalization, sized

2 years agoPrefer non-Self non-method types over Self, first
Michael Goulet [Wed, 17 Aug 2022 01:28:26 +0000 (01:28 +0000)]
Prefer non-Self non-method types over Self, first

2 years agoRework ambiguity errors
Michael Goulet [Wed, 17 Aug 2022 00:21:40 +0000 (00:21 +0000)]
Rework ambiguity errors

2 years agoNote closure kind mismatch cause
Michael Goulet [Thu, 18 Aug 2022 12:22:07 +0000 (12:22 +0000)]
Note closure kind mismatch cause

2 years agoRevert closure mismatch spans
Michael Goulet [Tue, 16 Aug 2022 23:54:54 +0000 (23:54 +0000)]
Revert closure mismatch spans

2 years agoDo not favor projection type when pointing out arg causing fulfillment error
Michael Goulet [Tue, 16 Aug 2022 23:37:56 +0000 (23:37 +0000)]
Do not favor projection type when pointing out arg causing fulfillment error

2 years agoSkip mentioning lang item
Michael Goulet [Tue, 16 Aug 2022 23:28:20 +0000 (23:28 +0000)]
Skip mentioning lang item

2 years agoAccount for relative paths
Michael Goulet [Tue, 16 Aug 2022 23:13:23 +0000 (23:13 +0000)]
Account for relative paths

2 years agoRework point-at-arg
Michael Goulet [Tue, 16 Aug 2022 06:27:22 +0000 (06:27 +0000)]
Rework point-at-arg

2 years agoAuto merge of #100536 - Alexendoo:bootstrap-tls-model, r=Mark-Simulacrum
bors [Sun, 21 Aug 2022 01:34:05 +0000 (01:34 +0000)]
Auto merge of #100536 - Alexendoo:bootstrap-tls-model, r=Mark-Simulacrum

bootstrap: don't apply `-Ztls-model=initial-exec` to proc macros

Potentially fixes #100530

r? `@bjorn3`

2 years agoAuto merge of #99967 - Mark-Simulacrum:download-llvm-ci, r=jyn514
bors [Sat, 20 Aug 2022 22:49:36 +0000 (22:49 +0000)]
Auto merge of #99967 - Mark-Simulacrum:download-llvm-ci, r=jyn514

Download, rather than sccache-cache, LLVM in CI

My hope/expectation is that we can do better than sccache in CI for cached builds -- currently it looks like on macOS those still take upwards of 10-11 minutes, which is a significant amount of time that we could potentially cut.

This enables this mode for all non-dist builders; this should avoid any problems with the artifacts we distribute, while also providing for faster test builders (since they'll make use of PGO'd LLVM on the platforms we do that on, which is hopefully a nice win). It slightly increases the chance of test builders starting to fail only after a PR is merged (if PGO changes runtime behavior), but that should hopefully never happen, so I think this is worthwhile.

Measurements on the PR for apple-1 don't show any noticeable improvement in CI times, but those can be pretty noisy -- I'm inclined to land this since it *should* pretty much always be better and we can reconsider if that ever turns out not to be the case.

2 years agoMake some docs nicer wrt pointer offsets
Maybe Waffle [Fri, 19 Aug 2022 09:33:46 +0000 (13:33 +0400)]
Make some docs nicer wrt pointer offsets

2 years agoReplace most uses of `pointer::offset` with `add` and `sub`
Maybe Waffle [Fri, 19 Aug 2022 09:33:06 +0000 (13:33 +0400)]
Replace most uses of `pointer::offset` with `add` and `sub`

2 years agoImprove primitive/std docs separation and headers
Cameron Steffen [Sat, 30 Apr 2022 17:01:31 +0000 (12:01 -0500)]
Improve primitive/std docs separation and headers