Skip to content

Commit 31d75c4

Browse files
committed
Auto merge of #65076 - tmandry:rollup-ka7nzb6, r=tmandry
Rollup of 11 pull requests Successful merges: - #61879 (Stabilize todo macro) - #64675 (Deprecate `#![plugin]` & `#[plugin_registrar]`) - #64690 (proc_macro API: Expose `macro_rules` hygiene) - #64706 (add regression test for #60218) - #64741 (Prevent rustdoc feature doctests) - #64842 (Disallow Self in type param defaults of ADTs) - #65004 (Replace mentions of IRC with Discord) - #65018 (Set RUST_BACKTRACE=0 in tests that include a backtrace in stderr) - #65055 (Add long error explanation for E0556) - #65056 (Make visit projection iterative) - #65057 (typo: fix typo in E0392) Failed merges: r? @ghost
2 parents 032a53a + cc5dcfa commit 31d75c4

File tree

111 files changed

+1173
-425
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+1173
-425
lines changed

CODE_OF_CONDUCT.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ In the Rust community we strive to go the extra step to look out for each other.
3333

3434
And if someone takes issue with something you said or did, resist the urge to be defensive. Just stop doing what it was they complained about and apologize. Even if you feel you were misinterpreted or unfairly accused, chances are good there was something you could've communicated better — remember that it's your responsibility to make your fellow Rustaceans comfortable. Everyone wants to get along and we are all here first and foremost because we want to talk about cool technology. You will find that people will be eager to assume good intent and forgive as long as you earn their trust.
3535

36-
The enforcement policies listed above apply to all official Rust venues; including official IRC channels (#rust, #rust-internals, #rust-tools, #rust-libs, #rustc, #rust-beginners, #rust-docs, #rust-community, #rust-lang, and #cargo); GitHub repositories under rust-lang, rust-lang-nursery, and rust-lang-deprecated; and all forums under rust-lang.org (users.rust-lang.org, internals.rust-lang.org). For other projects adopting the Rust Code of Conduct, please contact the maintainers of those projects for enforcement. If you wish to use this code of conduct for your own project, consider explicitly mentioning your moderation policy or making a copy with your own moderation policy so as to avoid confusion.
36+
The enforcement policies listed above apply to all official Rust venues; including all communication channels (Rust Discord server, Rust Zulip server); GitHub repositories under rust-lang, rust-lang-nursery, and rust-lang-deprecated; and all forums under rust-lang.org (users.rust-lang.org, internals.rust-lang.org). For other projects adopting the Rust Code of Conduct, please contact the maintainers of those projects for enforcement. If you wish to use this code of conduct for your own project, consider explicitly mentioning your moderation policy or making a copy with your own moderation policy so as to avoid confusion.
3737

3838
*Adapted from the [Node.js Policy on Trolling](https://blog.izs.me/2012/08/policy-on-trolling) as well as the [Contributor Covenant v1.3.0](https://www.contributor-covenant.org/version/1/3/0/).*
3939

CONTRIBUTING.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ links to the major sections:
1515
* [Helpful Links and Information](#helpful-links-and-information)
1616

1717
If you have questions, please make a post on [internals.rust-lang.org][internals] or
18-
hop on the [Rust Discord server][rust-discord], [Rust Zulip server][rust-zulip] or [#rust-internals][pound-rust-internals].
18+
hop on the [Rust Discord server][rust-discord] or [Rust Zulip server][rust-zulip].
1919

2020
As a reminder, all contributors are expected to follow our [Code of Conduct][coc].
2121

@@ -25,7 +25,6 @@ to contribute to it in more detail than this document.
2525
If this is your first time contributing, the [walkthrough] chapter of the guide
2626
can give you a good example of how a typical contribution would go.
2727

28-
[pound-rust-internals]: https://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-internals
2928
[internals]: https://internals.rust-lang.org
3029
[rust-discord]: http://discord.gg/rust-lang
3130
[rust-zulip]: https://rust-lang.zulipchat.com
@@ -404,7 +403,7 @@ If you're looking for somewhere to start, check out the [E-easy][eeasy] tag.
404403
There are a number of other ways to contribute to Rust that don't deal with
405404
this repository.
406405

407-
Answer questions in [#rust][pound-rust], or on [users.rust-lang.org][users],
406+
Answer questions in the _Get Help!_ channels from the [Rust Discord server][rust-discord], on [users.rust-lang.org][users],
408407
or on [StackOverflow][so].
409408

410409
Participate in the [RFC process](https://github.com/rust-lang/rfcs).
@@ -413,7 +412,7 @@ Find a [requested community library][community-library], build it, and publish
413412
it to [Crates.io](http://crates.io). Easier said than done, but very, very
414413
valuable!
415414

416-
[pound-rust]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust
415+
[rust-discord]: https://discord.gg/rust-lang
417416
[users]: https://users.rust-lang.org/
418417
[so]: http://stackoverflow.com/questions/tagged/rust
419418
[community-library]: https://github.com/rust-lang/rfcs/labels/A-community-library

README.md

+5-7
Original file line numberDiff line numberDiff line change
@@ -244,19 +244,17 @@ The Rust community congregates in a few places:
244244
245245
To contribute to Rust, please see [CONTRIBUTING](CONTRIBUTING.md).
246246
247-
Rust has an [IRC] culture and most real-time collaboration happens in a
248-
variety of channels on Mozilla's IRC network, irc.mozilla.org. The
249-
most popular channel is [#rust], a venue for general discussion about
250-
Rust. And a good place to ask for help would be [#rust-beginners].
247+
Most real-time collaboration happens in a variety of channels on the
248+
[Rust Discord server][rust-discord], with channels dedicated for getting help,
249+
community, documentation, and all major contribution areas in the Rust ecosystem.
250+
A good place to ask for help would be the #help channel.
251251
252252
The [rustc guide] might be a good place to start if you want to find out how
253253
various parts of the compiler work.
254254
255255
Also, you may find the [rustdocs for the compiler itself][rustdocs] useful.
256256
257-
[IRC]: https://en.wikipedia.org/wiki/Internet_Relay_Chat
258-
[#rust]: irc://irc.mozilla.org/rust
259-
[#rust-beginners]: irc://irc.mozilla.org/rust-beginners
257+
[rust-discord]: https://discord.gg/rust-lang
260258
[rustc guide]: https://rust-lang.github.io/rustc-guide/about-this-guide.html
261259
[rustdocs]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/
262260

src/bootstrap/README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,8 @@ are:
328328
`Config` struct.
329329
* Adding a sanity check? Take a look at `bootstrap/sanity.rs`.
330330

331-
If you have any questions feel free to reach out on `#rust-infra` on IRC or ask on
332-
internals.rust-lang.org. When you encounter bugs, please file issues on the
333-
rust-lang/rust issue tracker.
331+
If you have any questions feel free to reach out on `#infra` channel in the
332+
[Rust Discord server][rust-discord] or ask on internals.rust-lang.org. When
333+
you encounter bugs, please file issues on the rust-lang/rust issue tracker.
334+
335+
[rust-discord]: https://discord.gg/rust-lang

src/libcore/macros.rs

+10-6
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ macro_rules! writeln {
465465
/// The unsafe counterpart of this macro is the [`unreachable_unchecked`] function, which
466466
/// will cause undefined behavior if the code is reached.
467467
///
468-
/// [`panic!`]: ../std/macro.panic.html
468+
/// [`panic!`]: ../std/macro.panic.html
469469
/// [`unreachable_unchecked`]: ../std/hint/fn.unreachable_unchecked.html
470470
/// [`std::hint`]: ../std/hint/index.html
471471
///
@@ -474,6 +474,7 @@ macro_rules! writeln {
474474
/// This will always [`panic!`]
475475
///
476476
/// [`panic!`]: ../std/macro.panic.html
477+
///
477478
/// # Examples
478479
///
479480
/// Match arms:
@@ -525,6 +526,9 @@ macro_rules! unreachable {
525526
/// code type-check, or if you're implementing a trait that requires multiple
526527
/// methods, and you're only planning on using one of them.
527528
///
529+
/// There is no difference between `unimplemented!` and `todo!` apart from the
530+
/// name.
531+
///
528532
/// # Panics
529533
///
530534
/// This will always [panic!](macro.panic.html)
@@ -579,8 +583,10 @@ macro_rules! unimplemented {
579583
/// Indicates unfinished code.
580584
///
581585
/// This can be useful if you are prototyping and are just looking to have your
582-
/// code typecheck. `todo!` works exactly like `unimplemented!`. The only
583-
/// difference between the two macros is the name.
586+
/// code typecheck.
587+
///
588+
/// There is no difference between `unimplemented!` and `todo!` apart from the
589+
/// name.
584590
///
585591
/// # Panics
586592
///
@@ -602,8 +608,6 @@ macro_rules! unimplemented {
602608
/// `baz()`, so we can use `todo!`:
603609
///
604610
/// ```
605-
/// #![feature(todo_macro)]
606-
///
607611
/// # trait Foo {
608612
/// # fn bar(&self);
609613
/// # fn baz(&self);
@@ -629,7 +633,7 @@ macro_rules! unimplemented {
629633
/// }
630634
/// ```
631635
#[macro_export]
632-
#[unstable(feature = "todo_macro", issue = "59277")]
636+
#[stable(feature = "todo_macro", since = "1.39.0")]
633637
macro_rules! todo {
634638
() => (panic!("not yet implemented"));
635639
($($arg:tt)+) => (panic!("not yet implemented: {}", $crate::format_args!($($arg)+)));

src/libproc_macro/bridge/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ macro_rules! with_api {
148148
fn debug($self: $S::Span) -> String;
149149
fn def_site() -> $S::Span;
150150
fn call_site() -> $S::Span;
151+
fn mixed_site() -> $S::Span;
151152
fn source_file($self: $S::Span) -> $S::SourceFile;
152153
fn parent($self: $S::Span) -> Option<$S::Span>;
153154
fn source($self: $S::Span) -> $S::Span;

src/libproc_macro/lib.rs

+9
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,15 @@ impl Span {
271271
Span(bridge::client::Span::call_site())
272272
}
273273

274+
/// A span that represents `macro_rules` hygiene, and sometimes resolves at the macro
275+
/// definition site (local variables, labels, `$crate`) and sometimes at the macro
276+
/// call site (everything else).
277+
/// The span location is taken from the call-site.
278+
#[unstable(feature = "proc_macro_mixed_site", issue = "65049")]
279+
pub fn mixed_site() -> Span {
280+
Span(bridge::client::Span::mixed_site())
281+
}
282+
274283
/// The original source file into which this span points.
275284
#[unstable(feature = "proc_macro_span", issue = "54725")]
276285
pub fn source_file(&self) -> SourceFile {

src/librustc/mir/visit.rs

+38-20
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,15 @@ macro_rules! make_mir_visitor {
166166
self.super_projection(base, projection, context, location);
167167
}
168168

169+
fn visit_projection_elem(&mut self,
170+
base: & $($mutability)? PlaceBase<'tcx>,
171+
proj_base: & $($mutability)? [PlaceElem<'tcx>],
172+
elem: & $($mutability)? PlaceElem<'tcx>,
173+
context: PlaceContext,
174+
location: Location) {
175+
self.super_projection_elem(base, proj_base, elem, context, location);
176+
}
177+
169178
fn visit_constant(&mut self,
170179
constant: & $($mutability)? Constant<'tcx>,
171180
location: Location) {
@@ -725,27 +734,36 @@ macro_rules! make_mir_visitor {
725734
projection: & $($mutability)? [PlaceElem<'tcx>],
726735
context: PlaceContext,
727736
location: Location) {
728-
if let [proj_base @ .., elem] = projection {
729-
self.visit_projection(base, proj_base, context, location);
737+
let mut cursor = projection;
738+
while let [proj_base @ .., elem] = cursor {
739+
cursor = proj_base;
740+
self.visit_projection_elem(base, cursor, elem, context, location);
741+
}
742+
}
730743

731-
match elem {
732-
ProjectionElem::Field(_field, ty) => {
733-
self.visit_ty(ty, TyContext::Location(location));
734-
}
735-
ProjectionElem::Index(local) => {
736-
self.visit_local(
737-
local,
738-
PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy),
739-
location
740-
);
741-
}
742-
ProjectionElem::Deref |
743-
ProjectionElem::Subslice { from: _, to: _ } |
744-
ProjectionElem::ConstantIndex { offset: _,
745-
min_length: _,
746-
from_end: _ } |
747-
ProjectionElem::Downcast(_, _) => {
748-
}
744+
fn super_projection_elem(&mut self,
745+
_base: & $($mutability)? PlaceBase<'tcx>,
746+
_proj_base: & $($mutability)? [PlaceElem<'tcx>],
747+
elem: & $($mutability)? PlaceElem<'tcx>,
748+
_context: PlaceContext,
749+
location: Location) {
750+
match elem {
751+
ProjectionElem::Field(_field, ty) => {
752+
self.visit_ty(ty, TyContext::Location(location));
753+
}
754+
ProjectionElem::Index(local) => {
755+
self.visit_local(
756+
local,
757+
PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy),
758+
location
759+
);
760+
}
761+
ProjectionElem::Deref |
762+
ProjectionElem::Subslice { from: _, to: _ } |
763+
ProjectionElem::ConstantIndex { offset: _,
764+
min_length: _,
765+
from_end: _ } |
766+
ProjectionElem::Downcast(_, _) => {
749767
}
750768
}
751769
}

src/librustc_mir/transform/check_consts/validation.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -404,25 +404,25 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
404404
self.super_assign(dest, rvalue, location);
405405
}
406406

407-
fn visit_projection(
407+
fn visit_projection_elem(
408408
&mut self,
409409
place_base: &PlaceBase<'tcx>,
410-
proj: &[PlaceElem<'tcx>],
410+
proj_base: &[PlaceElem<'tcx>],
411+
elem: &PlaceElem<'tcx>,
411412
context: PlaceContext,
412413
location: Location,
413414
) {
414415
trace!(
415-
"visit_place_projection: proj={:?} context={:?} location={:?}",
416-
proj,
416+
"visit_projection_elem: place_base={:?} proj_base={:?} elem={:?} \
417+
context={:?} location={:?}",
418+
place_base,
419+
proj_base,
420+
elem,
417421
context,
418422
location,
419423
);
420-
self.super_projection(place_base, proj, context, location);
421424

422-
let (elem, proj_base) = match proj.split_last() {
423-
Some(x) => x,
424-
None => return,
425-
};
425+
self.super_projection_elem(place_base, proj_base, elem, context, location);
426426

427427
match elem {
428428
ProjectionElem::Deref => {

0 commit comments

Comments
 (0)