Commit Graph

12283 Commits

Author SHA1 Message Date
bors
133859d680 Auto merge of #88672 - camelid:inc-parser-sugg, r=davidtwco
Suggest `i += 1` when we see `i++` or `++i`

Closes #83502 (for `i++` and `++i`; `--i` should be covered by #82987, and `i--`
is tricky to handle).

This is a continuation of #83536.

r? `@estebank`
2022-04-03 05:24:20 +00:00
David Morrison
aa67016624 make memcmp return a value of c_int_width instead of i32 2022-04-02 17:21:08 -07:00
Michael Goulet
7d7715fbbc Suggest borrowing when trying to coerce unsized type into dyn Trait 2022-04-02 16:43:17 -07:00
bors
c1550e3f8c Auto merge of #95590 - GuillaumeGomez:multi-line-attr-handling-doctest, r=notriddle
Fix multiline attributes handling in doctests

Fixes #55713.

I needed to have access to the `unclosed_delims` field in order to check that the attribute was completely parsed and didn't have missing parts, so I created a getter for it.

r? `@notriddle`
2022-04-02 23:39:25 +00:00
Michael Goulet
b899251f2d Fix late-bound ICE in unsized return suggestion 2022-04-02 15:29:55 -07:00
Vadim Petrochenkov
a169d337e4 linker: Implicitly link native libs as whole-archive in some more cases 2022-04-03 00:33:39 +03:00
Camille GILLOT
297dde9b1a Less manipulation of the callee_def_id. 2022-04-02 23:28:09 +02:00
Camille GILLOT
2d3d9b26a4 Use only local hash. 2022-04-02 23:23:19 +02:00
Camille GILLOT
e1b36f5ae2 Use DefPathHash instead of HirId to break cycles. 2022-04-02 23:23:19 +02:00
bors
76d770ac21 Auto merge of #95600 - Dylan-DPC:rollup-580y2ra, r=Dylan-DPC
Rollup of 4 pull requests

Successful merges:

 - #95587 (Remove need for associated_type_bounds in std.)
 - #95589 (Include a header in .rlink files)
 - #95593 (diagnostics: add test case for bogus T:Sized suggestion)
 - #95597 (Refer to u8 by absolute path in expansion of thread_local)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-04-02 20:58:33 +00:00
Dylan DPC
30c0738d1f
Rollup merge of #95589 - Kobzol:rlink-header, r=bjorn3
Include a header in .rlink files

I couldn't find the right place where to put tests. Is there some location that tests `.rlink` creation and loading?
I only found `src/test/run-make-fulldeps/separate-link/Makefile`, but I'm not sure how to check the error message in the Makefile.

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

r? `@bjorn3`
2022-04-02 22:38:20 +02:00
Guillaume Gomez
c37cd911a4 Fix doctest multi-line mod attributes handling 2022-04-02 20:53:19 +02:00
bors
8f96ef4bb5 Auto merge of #94911 - jackh726:gats_extended_2, r=compiler-errors
Make GATs object safe under generic_associated_types_extended feature

Based on #94869

Let's say we have
```rust
trait StreamingIterator {
    type Item<'a> where Self: 'a;
}
```
And `dyn for<'a> StreamingIterator<Item<'a> = &'a i32>`.

If we ask `(dyn for<'a> StreamingIterator<Item<'a> = &'a i32>): StreamingIterator`, then we have to prove that `for<'x> (&'x i32): Sized`. So, we generate *new* bound vars to subst for the GAT generics.

Importantly, this doesn't fully verify that these are usable and sound.

r? `@nikomatsakis`
2022-04-02 18:34:26 +00:00
Jack Huey
52b00db235 Make GATs object safe under generic_associated_types_extended feature 2022-04-02 14:01:17 -04:00
Jakub Beránek
b81d873cdf
Address review comments and add a test 2022-04-02 17:26:39 +02:00
Jakub Beránek
e0d4226677
Include a header in .rlink files to provide nicer error messages when a wrong file is parsed as .rlink 2022-04-02 16:50:08 +02:00
bors
fbc45b650a Auto merge of #95537 - GuillaumeGomez:type_of-doc, r=Dylan-DPC
Improve TyCtxt::type_of documentation

r? `@oli-obk`
2022-04-02 12:13:11 +00:00
Guillaume Gomez
6fdeee4be3 Improve TyCtxt::type_of documentation 2022-04-02 13:57:27 +02:00
bors
07a461ad52 Auto merge of #95571 - petrochenkov:nowrapident2, r=Aaron1011
ast_lowering: Stop wrapping `ident` matchers into groups

The lowered forms goes to metadata, for example during encoding of macro definitions.
This is a missing part of https://github.com/rust-lang/rust/pull/92472.

Fixes https://github.com/rust-lang/rust/issues/95569
r? `@Aaron1011`
2022-04-02 07:42:50 +00:00
bors
95f68702ff Auto merge of #95509 - nnethercote:simplify-MatcherPos-some-more, r=petrochenkov
Simplify `MatcherPos` some more

A few more improvements.

r? `@petrochenkov`
2022-04-02 04:59:16 +00:00
Dylan DPC
1c82fac3f7
Rollup merge of #95560 - lcnr:obligation-cause, r=oli-obk
convert more `DefId`s to `LocalDefId`
2022-04-02 03:34:27 +02:00
Dylan DPC
1e43cf46bd
Rollup merge of #95559 - lcnr:inferctxt-typeck, r=oli-obk
small type system refactoring
2022-04-02 03:34:26 +02:00
Dylan DPC
556c7411cc
Rollup merge of #95544 - jam1garner:improve-naked-noreturn-diagnostic, r=tmiasko
Add error message suggestion for missing noreturn in naked function

I had to google the syntax for inline asm's `noreturn` option when I got this error earlier today, so I figured I'd save others the trouble and add the syntax/fix as a suggestion in the error.
2022-04-02 03:34:23 +02:00
Dylan DPC
46a4754df0
Rollup merge of #95430 - ChrisDenton:disable-tls-i686-msvc, r=nagisa
Disable #[thread_local] support on i686-pc-windows-msvc

Fixes #95429
2022-04-02 03:34:22 +02:00
Dylan DPC
be7c363182
Rollup merge of #95373 - RalfJung:invalid_value, r=davidtwco
invalid_value lint: detect invalid initialization of arrays
2022-04-02 03:34:21 +02:00
Dylan DPC
d7a24003d8
Rollup merge of #95354 - dtolnay:rustc_const_stable, r=lcnr
Handle rustc_const_stable attribute in library feature collector

The library feature collector in [compiler/rustc_passes/src/lib_features.rs](551b4fa395/compiler/rustc_passes/src/lib_features.rs) has only been looking at `#[stable(…)]`, `#[unstable(…)]`, and `#[rustc_const_unstable(…)]` attributes, while ignoring `#[rustc_const_stable(…)]`. The consequences of this were:

- When any const feature got stabilized (changing one or more `rustc_const_unstable` to `rustc_const_stable`), users who had previously enabled that unstable feature using `#![feature(…)]` would get told "unknown feature", rather than rustc's nicer "the feature … has been stable since … and no longer requires an attribute to enable".

    This can be seen in the way that https://github.com/rust-lang/rust/pull/93957#issuecomment-1079794660 failed after rebase:

    ```console
    error[E0635]: unknown feature `const_ptr_offset`
      --> $DIR/offset_from_ub.rs:1:35
       |
    LL | #![feature(const_ptr_offset_from, const_ptr_offset)]
       |                                   ^^^^^^^^^^^^^^^^
    ```

- We weren't enforcing that a particular feature is either stable everywhere or unstable everywhere, and that a feature that has been stabilized has the same stabilization version everywhere, both of which we enforce for the other stability attributes.

This PR updates the library feature collector to handle `rustc_const_stable`, and fixes places in the standard library and test suite where `rustc_const_stable` was being used in a way that does not meet the rules for a stability attribute.
2022-04-02 03:34:21 +02:00
bors
eb82facb16 Auto merge of #94883 - cjgillot:flat-metadata, r=oli-obk
Encode even more metadata through tables instead of EntryKind

This should move us closer to getting rid of `EntryKind`.
2022-04-01 21:16:41 +00:00
Vadim Petrochenkov
a150fc2990 ast_lowering: Stop wrapping ident matchers into groups
The lowered forms goes to metadata, for example during encoding of macro definitions
2022-04-02 00:09:34 +03:00
bors
297a8018b5 Auto merge of #95552 - matthiaskrgr:rollup-bxminn9, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #95032 (Clean up, categorize and sort unstable features in std.)
 - #95260 (Better suggestions for `Fn`-family trait selection errors)
 - #95293 (suggest wrapping single-expr blocks in square brackets)
 - #95344 (Make `impl Debug for rustdoc::clean::Item` easier to read)
 - #95388 (interpret: make isize::MAX the limit for dynamic value sizes)
 - #95530 (rustdoc: do not show primitives and keywords as private)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-04-01 17:19:15 +00:00
jam1garner
f793b696c8 Reword purpose description of noreturn in naked function 2022-04-01 11:28:45 -04:00
jam1garner
0df84cdc49 Don't emit non-asm contents error for naked function composed of errors 2022-04-01 11:02:36 -04:00
Ralf Jung
af24588a06 invalid_value lint: detect invalid initialization of arrays 2022-04-01 09:59:11 -04:00
lcnr
8eacf6078f update comment 2022-04-01 13:47:01 +02:00
lcnr
796b828371 convert more DefIds to LocalDefId 2022-04-01 13:38:43 +02:00
lcnr
389c83b474 remove unused incorrect EqUnifyValue impl 2022-04-01 12:57:24 +02:00
lcnr
c2b5a7ea52 remove unify_key::replace_if_possible 2022-04-01 12:41:46 +02:00
lcnr
18fae7b2e5 update comments 2022-04-01 12:41:46 +02:00
Matthias Krüger
f37bca4d7c
Rollup merge of #95531 - petrochenkov:metacount, r=nnethercote
expand: Do not count metavar declarations on RHS of `macro_rules`

They are 0 by definition there.

Addresses https://github.com/rust-lang/rust/pull/95425#discussion_r837410476
r? ```@nnethercote```
2022-04-01 12:07:04 +02:00
Matthias Krüger
cdf178f776
Rollup merge of #95388 - RalfJung:rust-val-limit, r=oli-obk
interpret: make isize::MAX the limit for dynamic value sizes

We are currently enforcing `data_layout.obj_size_bound()` as the maximal dynamic size of a Rust value (including for `size_of_val_raw`), but that does not match the docs.

In particular, Miri currently falsely says that this code has UB:
```rust
#![feature(layout_for_ptr)]
fn main() {
    let size = isize::MAX as usize;
    // Creating a raw slice of size isize::MAX and asking for its size is okay.
    let s = std::ptr::slice_from_raw_parts(1usize as *const u8, size);
    assert_eq!(size, unsafe { std::mem::size_of_val_raw(s) });
}
```
2022-04-01 06:59:44 +02:00
Matthias Krüger
8f493fd46a
Rollup merge of #95293 - compiler-errors:braces, r=davidtwco
suggest wrapping single-expr blocks in square brackets

Suggests a fix in cases like:

```diff
- const A: [i32; 1] = { 1 };

+ const A: [i32; 1] = [ 1 ];
                      ^   ^
```

Also edit the message for the same suggestion in the parser (e.g. `{ 1, 2 }`).

Fixes #95289
2022-04-01 06:59:42 +02:00
Matthias Krüger
94b1960535
Rollup merge of #95260 - compiler-errors:fn, r=davidtwco
Better suggestions for `Fn`-family trait selection errors

1. Suppress suggestions to add `std::ops::Fn{,Mut,Once}` bounds when a type already implements `Fn{,Mut,Once}`
2. Add a note that points out that a type does in fact implement `Fn{,Mut,Once}`, but the arguments vary (either by number or by actual arguments)
3. Add a note that points out that a type does in fact implement `Fn{,Mut,Once}`, but not the right one (e.g. implements `FnMut`, but `Fn` is required).

Fixes #95147
2022-04-01 06:59:41 +02:00
jam1garner
b657cb5577 Add error message suggestion for missing noreturn in naked function 2022-03-31 18:34:20 -04:00
David Tolnay
5d30180634
Handle rustc_const_stable attribute in library feature collector 2022-03-31 12:34:46 -07:00
bors
0677edc86e Auto merge of #95526 - Dylan-DPC:rollup-0ikl5l5, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #91416 (Specialize infinite-type "insert some indirection" suggestion for Option)
 - #95384 (Update target_has_atomic documentation for stabilization)
 - #95517 (small rustc_borrowck cleanup)
 - #95520 (Fix typos in core::ptr docs)
 - #95523 (remove unused field from `infcx`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-31 17:45:26 +00:00
Camille GILLOT
15b2d1a97c Merge impl_constness and is_const_fn_raw. 2022-03-31 18:33:46 +02:00
Camille GILLOT
e62f483842 Create trait_def table. 2022-03-31 18:14:54 +02:00
Camille GILLOT
618138b923 Store fn constness in impl_constness. 2022-03-31 18:14:49 +02:00
Vadim Petrochenkov
9ab4f732cb expand: Do not count metavar declarations on RHS of macro_rules
They are 0 by definition there.
2022-03-31 19:09:40 +03:00
Camille GILLOT
f2bf484e3a Introduce repr_options table. 2022-03-31 17:56:32 +02:00
Dylan DPC
1074c814af
Rollup merge of #95523 - lcnr:yeet-unused-field, r=oli-obk
remove unused field from `infcx`

r? `@oli-obk` did we stop needing that for opaque types?
2022-03-31 17:29:56 +02:00
Dylan DPC
1f86789bb3
Rollup merge of #95517 - lcnr:rustc_borrowck-misc, r=jackh726
small rustc_borrowck cleanup

r? `@jackh726` because of the second commit, seems like that comment was missed in #91243
2022-03-31 17:29:54 +02:00
Dylan DPC
521c590c9f
Rollup merge of #91416 - compiler-errors:infinite-ty-option-box, r=estebank
Specialize infinite-type "insert some indirection" suggestion for Option

Suggest `Option<Box<_>>` instead of `Box<Option<_>>` for infinitely-recursive members of a struct.

Not sure if I can get the span of the generic subty of the Option so I can make this a `+++`-style suggestion. The current output is a tiny bit less fancy looking than the original suggestion.

Should I limit the specialization to just `Option<Box<TheOuterStruct>>`? Because right now it applies to all `Option` members in the struct that are returned by `Representability::SelfRecursive`.

Fixes #91402

r? `@estebank`
(since you wrote the original suggestion and are definitely most familiar with it!)
2022-03-31 17:29:52 +02:00
bors
bd1a8692f6 Auto merge of #90204 - cjgillot:owner-pull, r=michaelwoerister
Make lowering pull-based

~Based on https://github.com/rust-lang/rust/pull/90451~
Part of https://github.com/rust-lang/rust/pull/88186

The current lowering code visits all the item-likes in the AST in order, and lowers them one by one.
This PR changes it to index the AST and then proceed to lowering on-demand. This is closer to the logic of query-based lowering.
2022-03-31 15:20:59 +00:00
lcnr
a5c68d747e remove unused field from infcx 2022-03-31 17:14:42 +02:00
Michael Goulet
c74f7a310f address comments, add test for shadowed Box type 2022-03-31 08:04:53 -07:00
Michael Goulet
de04c05dea Specialize suggestion for Option<T> 2022-03-31 08:04:53 -07:00
lcnr
89c66eb42d update comment 2022-03-31 15:41:52 +02:00
Ralf Jung
a417911c16 catch overflow in slice size computation 2022-03-31 08:57:45 -04:00
Ralf Jung
53c540a666 audit check_mul uses in interpret 2022-03-31 08:57:45 -04:00
Ralf Jung
a421cbbead interpret: make isize::MAX the limit for dynamic value sizes 2022-03-31 08:57:45 -04:00
bors
03314912f1 Auto merge of #95511 - Dylan-DPC:rollup-4n880fd, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #95445 (Don't build the full compiler before running unit tests)
 - #95470 (Fix last rustdoc-gui spurious test)
 - #95478 (Add note to the move size diagnostic)
 - #95495 (Remove unneeded `to_string` call)
 - #95505 (Fix library/std compilation on openbsd.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-31 12:55:13 +00:00
Camille GILLOT
6b099db18c Record item-likes in ItemLowerer. 2022-03-31 13:48:16 +02:00
Camille GILLOT
e5d482eeca Create a new LoweringContext for each item-like. 2022-03-31 13:47:56 +02:00
Camille GILLOT
6e4fb2038a Make lowering pull-based. 2022-03-31 13:47:22 +02:00
Camille GILLOT
41902f2859 Implement with_parent_item_lifetime_defs on ItemLowerer. 2022-03-31 13:47:02 +02:00
Camille GILLOT
dc8b6b4be4 Move lower_crate outside the LoweringContext. 2022-03-31 13:46:40 +02:00
Camille GILLOT
4b598d3f75 Stop emitting lints during lowering. 2022-03-31 13:46:06 +02:00
Camille GILLOT
c10a1cebe7 Store next_disambiguator in Definitions. 2022-03-31 13:34:54 +02:00
Camille GILLOT
b29fa94d22 Remove mutability in ResolverAstLowering. 2022-03-31 13:24:33 +02:00
Dylan DPC
4388ac58a2
Rollup merge of #95478 - InfRandomness:infrandomness/lint_largemove_note, r=compiler-errors
Add note to the move size diagnostic

context: https://github.com/rust-lang/rust/issues/83518
2022-03-31 13:09:53 +02:00
lcnr
d7cada1767 obligation cause: RepeatVec -> RepeatValueCopy 2022-03-31 12:51:46 +02:00
bors
df20355fa9 Auto merge of #95456 - RalfJung:size, r=oli-obk
allow large Size again

This basically reverts most of https://github.com/rust-lang/rust/pull/80042, and instead does the panic in `bits()` with a `#[cold]` function to make sure it does not get inlined.

https://github.com/rust-lang/rust/pull/80042 added a comment about an invariant ("The top 3 bits are ALWAYS zero") that is not actually enforced, and if it were enforced that would be a problem for https://github.com/rust-lang/rust/pull/95388. So I think we should not have that invariant, and I adjusted the code accordingly.

r? `@oli-obk` Cc `@sivadeilra`
2022-03-31 10:33:56 +00:00
Nicholas Nethercote
c6fedd4f10 Make MatcherPos not derive Clone.
It's only used in one place, and there we clone and then make a bunch of
modifications. It's clearer if we duplicate more explicitly, and there's
a symmetry now between `sequence()` and `empty_sequence()`.
2022-03-31 14:40:43 +11:00
Nicholas Nethercote
f68a0449ed Remove MatcherPos::stack.
`parse_tt` needs a way to get from within submatchers make to the
enclosing submatchers. Currently it has two distinct mechanisms for
this:
- `Delimited` submatchers use `MatcherPos::stack` to record stuff about
  the parent (and further back ancestors).
- `Sequence` submatchers use `MatcherPosSequence::parent` to point to
  the parent matcher position.

Having two mechanisms is really confusing, and it took me a long time to
understand all this.

This commit eliminates `MatcherPos::stack`, and changes `Delimited`
submatchers to use the same mechanism as sequence submatchers. That
mechanism is also changed a bit: instead of storing the entire parent
`MatcherPos`, we now only store the necessary parts from the parent
`MatcherPos`.

Overall this is a small performance win, with the positives outweighing
the negatives, but it's mostly for clarity.
2022-03-31 14:39:00 +11:00
Dylan DPC
1b7d6dbd30
Rollup merge of #95497 - nyurik:compiler-spell-comments, r=compiler-errors
Spellchecking compiler comments

This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-03-31 04:57:28 +02:00
Dylan DPC
64a3767fee
Rollup merge of #95471 - oli-obk:tait_ice, r=estebank
Don't ICE when opaque types get their hidden type constrained again.

Contrary to popular belief, `codegen_fulfill_obligation` does not get used solely in codegen, so we cannot rely on `param_env` being set to RevealAll and thus revealing the hidden types instead of constraining them.

Fixes #89312 (for real this time)
2022-03-31 04:57:26 +02:00
Dylan DPC
4ce6567daa
Rollup merge of #95263 - compiler-errors:async-block-pretty, r=jackh726
Restore `impl Future<Output = Type>` to async blocks

I was sad when I undid some of the code I wrote in #91096 in the PR #95225, so I fixed it here to not print `[async output]`.

This PR "manually" normalizes the associated type `<[generator] as Generator>::Return` type which appears very frequently in `impl Future` types that result from async block desugaring.
2022-03-31 04:57:25 +02:00
Michael Goulet
7b2eaa3d8f Restore impl Future<Output = Type> to async blocks 2022-03-30 19:26:35 -07:00
Nicholas Nethercote
048bd67d51 Clarify idx handling in sequences.
By adding comments, and improving an assertion. I finally fully
understand this part!
2022-03-31 11:48:36 +11:00
Nicholas Nethercote
2e423c7fd0 Remove MatcherPos::match_lo.
It's redundant w.r.t. other fields.
2022-03-31 11:48:35 +11:00
Nicholas Nethercote
21699c41af Simplify exit of Delimited submatchers.
Currently, we detect an exit from a `Delimited` submatcher when `idx`
exceeds the bounds of the current submatcher *and* there is a `stack`
entry.

This commit changes it to something simpler: just look for a
`CloseDelim` token.
2022-03-31 11:48:34 +11:00
bors
a39ac5ae17 Auto merge of #95501 - Dylan-DPC:rollup-arx6sdc, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #93901 (Stabilize native library modifier syntax and the `whole-archive` modifier specifically)
 - #94806 (Fix `cargo run tidy`)
 - #94869 (Add the generic_associated_types_extended feature)
 - #95011 (async: Give predictable name to binding generated from .await expressions.)
 - #95251 (Reduce max hash in raw strings from u16 to u8)
 - #95298 (Fix double drop of allocator in IntoIter impl of Vec)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-31 00:29:54 +00:00
Dylan DPC
86388f6171
Rollup merge of #95251 - GrishaVar:hashes-u16-to-u8, r=dtolnay
Reduce max hash in raw strings from u16 to u8

[Relevant discussion](https://rust-lang.zulipchat.com/#narrow/stream/237824-t-lang.2Fdoc/topic/Max.20raw.20string.20delimiters)
2022-03-31 00:26:31 +02:00
Dylan DPC
1c3657b20d
Rollup merge of #95011 - michaelwoerister:awaitee_field, r=tmandry
async: Give predictable name to binding generated from .await expressions.

This name makes it to debuginfo and allows debuggers to identify such bindings and their captured versions in suspended async fns.

This will be useful for async stack traces, as discussed in https://internals.rust-lang.org/t/async-debugging-logical-stack-traces-setting-goals-collecting-examples/15547.

I don't know if this needs some discussion by ````@rust-lang/compiler,```` e.g. about the name of the binding (`__awaitee`) or about the fact that this PR introduces a (soft) guarantee about a compiler generated name. Although, regarding the later, I think the same reasoning applies here as it does for debuginfo in general.

r? ````@tmandry````
2022-03-31 00:26:30 +02:00
Dylan DPC
e08ab08a2e
Rollup merge of #94869 - jackh726:gats_extended, r=compiler-errors
Add the generic_associated_types_extended feature

Right now, this only ignore obligations that reference new placeholders in `poly_project_and_unify_type`. In the future, this might do other things, like allowing object-safe GATs.

**This feature is *incomplete* and quite likely unsound. This is mostly just for testing out potential future APIs using a "relaxed" set of rules until we figure out *proper* rules.**

Also drive by cleanup of adding a `ProjectAndUnifyResult` enum instead of using a `Result<Result<Option>>`.

r? `@nikomatsakis`
2022-03-31 00:26:29 +02:00
Dylan DPC
b75f384d0b
Rollup merge of #93901 - petrochenkov:linkmod, r=wesleywiser
Stabilize native library modifier syntax and the `whole-archive` modifier specifically

Stabilization report: https://github.com/rust-lang/rust/pull/93901#issuecomment-1041325522

cc https://github.com/rust-lang/rust/issues/81490
2022-03-31 00:26:28 +02:00
bors
a40c595695 Auto merge of #95436 - cjgillot:static-mut, r=oli-obk
Remember mutability in `DefKind::Static`.

This allows to compute the `BodyOwnerKind` from `DefKind` only, and
removes a direct dependency of some MIR queries onto HIR.

As a side effect, it also simplifies metadata, since we don't need 4
flavours of `EntryKind::*Static` any more.
2022-03-30 22:09:56 +00:00
Jack Huey
4e570a68a1 Add the generic_associated_types_extended feature 2022-03-30 17:41:11 -04:00
Yuri Astrakhan
8d7b124c1f a few mode feedback fixes per @bjorn3 2022-03-30 17:28:19 -04:00
Yuri Astrakhan
a6dd658254 Addressed comments by @compiler-errors and @bjorn3 2022-03-30 17:04:46 -04:00
Vadim Petrochenkov
1004783ef9 Stabilize native library modifier syntax and the whole-archive modifier specifically 2022-03-30 23:53:21 +03:00
Yuri Astrakhan
c9c6e22f4b Remove bad rustdoc trailing backslash 2022-03-30 15:50:27 -04:00
Yuri Astrakhan
5160f8f843 Spellchecking compiler comments
This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-03-30 15:14:15 -04:00
bors
c5cf08d37b Auto merge of #95425 - nnethercote:yet-more-parse_tt-improvements, r=petrochenkov
Yet more `parse_tt` improvements

Including lots of comment improvements, and an overhaul of how `matches` work that gives big speedups.

r? `@petrochenkov`
2022-03-30 19:08:01 +00:00
InfRandomness
d65b9a19db Add note to the lint diagnostic 2022-03-30 20:00:03 +02:00
Grisha Vartanyan
759d1e6af8 Update error message & remove outdated test comment 2022-03-30 18:20:30 +02:00
Oli Scherer
11446779b0 Don't ICE when opaque types get their hidden type constrained again.
Contrary to popular belief, `codegen_fulfill_obligation` does not get used solely in codegen, so we cannot rely on `param_env` being set to RevealAll and thus revealing the hidden types instead of constraining them.
2022-03-30 13:17:46 +00:00
bors
3e7514670d Auto merge of #94963 - lcnr:inherent-impls-std, r=oli-obk,m-ou-se
allow arbitrary inherent impls for builtin types in core

Part of https://github.com/rust-lang/compiler-team/issues/487. Slightly adjusted after some talks with `@m-ou-se` about the requirements of `t-libs-api`.

This adds a crate attribute `#![rustc_coherence_is_core]` which allows arbitrary impls for builtin types in core.

For other library crates impls for builtin types should be avoided if possible. We do have to allow the existing stable impls however. To prevent us from accidentally adding more of these in the future, there is a second attribute `#[rustc_allow_incoherent_impl]` which has to be added to **all impl items**. This only supports impls for builtin types but can easily be extended to additional types in a future PR.

This implementation does not check for overlaps in these impls. Perfectly checking that requires us to check the coherence of these incoherent impls in every crate, as two distinct dependencies may add overlapping methods. It should be easy enough to detect if it goes wrong and the attribute is only intended for use inside of std.

The first two commits are mostly unrelated cleanups.
2022-03-30 12:28:50 +00:00
bors
e50ff9b452 Auto merge of #95241 - Gankra:cleaned-provenance, r=workingjubilee
Strict Provenance MVP

This patch series examines the question: how bad would it be if we adopted
an extremely strict pointer provenance model that completely banished all
int<->ptr casts.

The key insight to making this approach even *vaguely* pallatable is the

ptr.with_addr(addr) -> ptr

function, which takes a pointer and an address and creates a new pointer
with that address and the provenance of the input pointer. In this way
the "chain of custody" is completely and dynamically restored, making the
model suitable even for dynamic checkers like CHERI and Miri.

This is not a formal model, but lots of the docs discussing the model
have been updated to try to the *concept* of this design in the hopes
that it can be iterated on.

See #95228
2022-03-30 10:09:10 +00:00
lcnr
01d4e835c1 typo 2022-03-30 11:24:26 +02:00