Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 10 pull requests #103604

Merged
merged 73 commits into from
Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
f310d4c
Don't auto-publish lib crates
Veykril Sep 27, 2022
d7fb8d5
Migrate assists to format args captures, part 2
DropDemBits Oct 10, 2022
d5f467a
Substitute some VSCode variables in the VSCode client
Veykril Oct 16, 2022
a2e4f78
Auto merge of #13399 - DropDemBits:assists-format-args-capture-pt2, r…
bors Oct 17, 2022
40cbeb5
Auto merge of #13423 - Veykril:vscode-vars, r=Veykril
bors Oct 17, 2022
f079792
Auto merge of #13302 - Veykril:auto-publish, r=Veykril
bors Oct 17, 2022
6f43597
Refactor language client handling
Veykril Oct 17, 2022
8aaafdd
Properly reload changed configs for server start
Veykril Oct 17, 2022
d68616a
Make more things private
Veykril Oct 17, 2022
0421756
Implement stop and start server commands
Veykril Oct 17, 2022
7b5c943
Downgrade vscode types dependency
Veykril Oct 17, 2022
d63c44e
Cleanup output channels
Veykril Oct 17, 2022
067c410
Auto merge of #13426 - Veykril:client-refactor, r=Veykril
bors Oct 17, 2022
e41023c
Make flycheck workdone progress reports cancellable
Veykril Oct 17, 2022
106285b
Auto merge of #13427 - Veykril:cancel-check, r=Veykril
bors Oct 17, 2022
a762bac
fix: Fix formatting requests hanging when r-a is still starting
Veykril Oct 17, 2022
4d4c05d
Auto merge of #13428 - Veykril:fmt-stuck, r=Veykril
bors Oct 17, 2022
8047512
Revert "feat: Diagnose some incorrect usages of the question mark ope…
Veykril Oct 18, 2022
97b357e
Auto merge of #13433 - rust-lang:revert-13354-try-stuff, r=Veykril
bors Oct 18, 2022
9d3e616
Simplify
Veykril Oct 19, 2022
3392573
Auto merge of #13439 - Veykril:simplify, r=Veykril
bors Oct 19, 2022
653dafa
Add some sysroot logging
Veykril Oct 19, 2022
82ac6f7
Auto merge of #13441 - Veykril:sysroot-logging, r=Veykril
bors Oct 19, 2022
7e2c41d
Implement invocation strategy config for build scripts
Veykril Aug 27, 2022
4a287d2
Implement invocation strategy config for checkOnSave
Veykril Sep 15, 2022
5174b65
Use correct invocation strategy config for checkOnSave
Veykril Sep 15, 2022
7db5029
{manifest-path} interpolation
Veykril Sep 26, 2022
4673236
Remove simplistic interpolation for manifest-path
Veykril Oct 19, 2022
a77ac93
Auto merge of #13128 - Veykril:invocation-strategy, r=Veykril
bors Oct 19, 2022
69b8456
Don't catch the server activation error
Veykril Oct 20, 2022
32614e2
Auto merge of #13444 - Veykril:rethrow-err, r=Veykril
bors Oct 20, 2022
5bff6c5
feat: add multiple getters mode in `generate_getter`
feniljain Oct 7, 2022
f3cce5f
Auto merge of #13365 - feniljain:master, r=Veykril
bors Oct 20, 2022
de195ff
fix: Fix DidSaveDocument requests blocking the server on startup
Veykril Oct 20, 2022
e05df93
Workaround the python vscode extension's polyfill
yotamofek Oct 20, 2022
7741e3d
Auto merge of #13448 - yotamofek:python-ext-polyfill-workaround, r=Ve…
bors Oct 20, 2022
2481721
Auto merge of #13447 - Veykril:didsavedoc-block, r=Veykril
bors Oct 20, 2022
a8e0a20
internal: Properly handle language configuration config changes
Veykril Oct 20, 2022
69f01fd
Auto merge of #13451 - Veykril:lang-config, r=Veykril
bors Oct 20, 2022
1cb4607
internal: Properly handle commands in the VSCode client when the serv…
Veykril Oct 21, 2022
8ee23f4
Auto merge of #13453 - Veykril:disabled-commands, r=Veykril
bors Oct 21, 2022
7ee7225
scip: minor clean-ups
emilio Oct 22, 2022
bd49d01
ide: Remove unnecessary continue.
emilio Oct 22, 2022
ec6d72b
scip: Rewrite tests to be closer to what we actually do.
emilio Oct 21, 2022
b643dd6
Auto merge of #13461 - emilio:ide-cleanup-continue, r=Veykril
bors Oct 22, 2022
d3b7e94
Auto merge of #13460 - emilio:scip-cleanups, r=Veykril
bors Oct 22, 2022
6459d7f
Support const generics for builtin derive macro
lowr Oct 22, 2022
19efa0b
Auto merge of #13463 - lowr:fix/builtin-derive-with-const-generics, r…
bors Oct 22, 2022
0f8904e
Implement invocation location config
Veykril Oct 22, 2022
b25f657
Auto merge of #13466 - Veykril:invocation-location, r=Veykril
bors Oct 22, 2022
859f559
Handle multiple projects sharing dependency correctly in `once` strategy
Veykril Oct 23, 2022
43fb956
Auto merge of #13471 - Veykril:invoc-strategy-once, r=Veykril
bors Oct 23, 2022
63d1a72
rustdoc: don't mark Box<T> as Iterator, Read, etc
jsha Oct 23, 2022
c246a3d
more dupe typos again
Rageking8 Oct 25, 2022
626d7fc
rustdoc: combine shared CSS between `.*-line-numbers`
notriddle Oct 25, 2022
6ea75ae
llvm-16: Don't initialize removed legacy passes
maurer Oct 25, 2022
67c4c1f
Update cargo
weihanglo Oct 26, 2022
99a74af
ptr::eq: clarify that comparing dyn Trait is fragile
RalfJung Oct 26, 2022
1946a18
explicitly mention that both components of wide prts are compared
RalfJung Oct 26, 2022
22a6bc4
:arrow_up: rust-analyzer
lnicola Oct 26, 2022
cce46e9
Fix typo in docs for `guaranteed_ne`
Oct 26, 2022
d1132fb
thread::set_name: debug-assert that things went well
RalfJung Oct 26, 2022
b66f921
rustc_lexer::TokenKind improve docs
tshepang Oct 26, 2022
ec7ffdf
Rollup merge of #103432 - jsha:box-is-not-notable, r=GuillaumeGomez
Oct 26, 2022
cafb63d
Rollup merge of #103526 - Rageking8:more-dupe-typos-again, r=Mark-Sim…
Oct 26, 2022
4907614
Rollup merge of #103537 - notriddle:notriddle/line-numbers, r=Guillau…
Oct 26, 2022
6e1de0e
Rollup merge of #103549 - maurer:llvm-main, r=cuviper
Oct 26, 2022
3bfe39e
Rollup merge of #103558 - weihanglo:update-cargo, r=weihanglo
Oct 26, 2022
26ad51f
Rollup merge of #103567 - RalfJung:ptr-eq-dyn-trait, r=dtolnay
Oct 26, 2022
1d5f328
Rollup merge of #103579 - lnicola:rust-analyzer-2022-10-26, r=lnicola
Oct 26, 2022
77145c0
Rollup merge of #103580 - lukas-code:guaranteed_ne, r=GuillaumeGomez
Oct 26, 2022
b4b3ff4
Rollup merge of #103596 - RalfJung:thread-setname, r=cuviper
Oct 26, 2022
132883e
Rollup merge of #103598 - tshepang:token-kind-docs, r=jackh726
Oct 26, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions compiler/rustc_lexer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,29 +57,42 @@ pub enum TokenKind {
// Multi-char tokens:
/// "// comment"
LineComment { doc_style: Option<DocStyle> },

/// `/* block comment */`
///
/// Block comments can be recursive, so the sequence like `/* /* */`
/// Block comments can be recursive, so a sequence like `/* /* */`
/// will not be considered terminated and will result in a parsing error.
BlockComment { doc_style: Option<DocStyle>, terminated: bool },
/// Any whitespace characters sequence.

/// Any whitespace character sequence.
Whitespace,

/// "ident" or "continue"
/// At this step keywords are also considered identifiers.
///
/// At this step, keywords are also considered identifiers.
Ident,

/// Like the above, but containing invalid unicode codepoints.
InvalidIdent,

/// "r#ident"
RawIdent,
/// An unknown prefix like `foo#`, `foo'`, `foo"`. Note that only the

/// An unknown prefix, like `foo#`, `foo'`, `foo"`.
///
/// Note that only the
/// prefix (`foo`) is included in the token, not the separator (which is
/// lexed as its own distinct token). In Rust 2021 and later, reserved
/// prefixes are reported as errors; in earlier editions, they result in a
/// (allowed by default) lint, and are treated as regular identifier
/// tokens.
UnknownPrefix,
/// "12_u8", "1.0e-40", "b"123"". See `LiteralKind` for more details.

/// Examples: `"12_u8"`, `"1.0e-40"`, `b"123`.
///
/// See [LiteralKind] for more details.
Literal { kind: LiteralKind, suffix_start: u32 },

/// "'a"
Lifetime { starts_with_number: bool },

Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ extern "C" void LLVMInitializePasses() {
initializeAnalysis(Registry);
initializeTransformUtils(Registry);
initializeInstCombine(Registry);
#if LLVM_VERSION_LT(16, 0)
initializeInstrumentation(Registry);
#endif
initializeTarget(Registry);
}

Expand Down
10 changes: 5 additions & 5 deletions library/alloc/src/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1110,8 +1110,8 @@ impl<T: ?Sized> Rc<T> {

#[inline]
#[stable(feature = "ptr_eq", since = "1.17.0")]
/// Returns `true` if the two `Rc`s point to the same allocation
/// (in a vein similar to [`ptr::eq`]).
/// Returns `true` if the two `Rc`s point to the same allocation in a vein similar to
/// [`ptr::eq`]. See [that function][`ptr::eq`] for caveats when comparing `dyn Trait` pointers.
///
/// # Examples
///
Expand Down Expand Up @@ -2419,9 +2419,9 @@ impl<T: ?Sized> Weak<T> {
}
}

/// Returns `true` if the two `Weak`s point to the same allocation (similar to
/// [`ptr::eq`]), or if both don't point to any allocation
/// (because they were created with `Weak::new()`).
/// Returns `true` if the two `Weak`s point to the same allocation similar to [`ptr::eq`], or if
/// both don't point to any allocation (because they were created with `Weak::new()`). See [that
/// function][`ptr::eq`] for caveats when comparing `dyn Trait` pointers.
///
/// # Notes
///
Expand Down
10 changes: 5 additions & 5 deletions library/alloc/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1117,8 +1117,8 @@ impl<T: ?Sized> Arc<T> {
drop(Weak { ptr: self.ptr });
}

/// Returns `true` if the two `Arc`s point to the same allocation
/// (in a vein similar to [`ptr::eq`]).
/// Returns `true` if the two `Arc`s point to the same allocation in a vein similar to
/// [`ptr::eq`]. See [that function][`ptr::eq`] for caveats when comparing `dyn Trait` pointers.
///
/// # Examples
///
Expand Down Expand Up @@ -2069,9 +2069,9 @@ impl<T: ?Sized> Weak<T> {
}
}

/// Returns `true` if the two `Weak`s point to the same allocation (similar to
/// [`ptr::eq`]), or if both don't point to any allocation
/// (because they were created with `Weak::new()`).
/// Returns `true` if the two `Weak`s point to the same allocation similar to [`ptr::eq`], or if
/// both don't point to any allocation (because they were created with `Weak::new()`). See [that
/// function][`ptr::eq`] for caveats when comparing `dyn Trait` pointers.
///
/// # Notes
///
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/ptr/const_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ impl<T: ?Sized> *const T {

/// Returns whether two pointers are guaranteed to be inequal.
///
/// At runtime this function behaves like `Some(self == other)`.
/// At runtime this function behaves like `Some(self != other)`.
/// However, in some contexts (e.g., compile-time evaluation),
/// it is not always possible to determine inequality of two pointers, so this function may
/// spuriously return `None` for pointers that later actually turn out to have its inequality known.
Expand Down
41 changes: 6 additions & 35 deletions library/core/src/ptr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1733,6 +1733,12 @@ pub(crate) unsafe fn align_offset<T: Sized>(p: *const T, a: usize) -> usize {
/// by their address rather than comparing the values they point to
/// (which is what the `PartialEq for &T` implementation does).
///
/// When comparing wide pointers, both the address and the metadata are tested for equality.
/// However, note that comparing trait object pointers (`*const dyn Trait`) is unrealiable: pointers
/// to values of the same underlying type can compare inequal (because vtables are duplicated in
/// multiple codegen units), and pointers to values of *different* underlying type can compare equal
/// (since identical vtables can be deduplicated within a codegen unit).
///
/// # Examples
///
/// ```
Expand All @@ -1759,41 +1765,6 @@ pub(crate) unsafe fn align_offset<T: Sized>(p: *const T, a: usize) -> usize {
/// assert!(!std::ptr::eq(&a[..2], &a[..3]));
/// assert!(!std::ptr::eq(&a[0..2], &a[1..3]));
/// ```
///
/// Traits are also compared by their implementation:
///
/// ```
/// #[repr(transparent)]
/// struct Wrapper { member: i32 }
///
/// trait Trait {}
/// impl Trait for Wrapper {}
/// impl Trait for i32 {}
///
/// let wrapper = Wrapper { member: 10 };
///
/// // Pointers have equal addresses.
/// assert!(std::ptr::eq(
/// &wrapper as *const Wrapper as *const u8,
/// &wrapper.member as *const i32 as *const u8
/// ));
///
/// // Objects have equal addresses, but `Trait` has different implementations.
/// assert!(!std::ptr::eq(
/// &wrapper as &dyn Trait,
/// &wrapper.member as &dyn Trait,
/// ));
/// assert!(!std::ptr::eq(
/// &wrapper as &dyn Trait as *const dyn Trait,
/// &wrapper.member as &dyn Trait as *const dyn Trait,
/// ));
///
/// // Converting the reference to a `*const u8` compares by address.
/// assert!(std::ptr::eq(
/// &wrapper as &dyn Trait as *const dyn Trait as *const u8,
/// &wrapper.member as &dyn Trait as *const dyn Trait as *const u8,
/// ));
/// ```
#[stable(feature = "ptr_eq", since = "1.17.0")]
#[inline]
pub fn eq<T: ?Sized>(a: *const T, b: *const T) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/ptr/mut_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ impl<T: ?Sized> *mut T {

/// Returns whether two pointers are guaranteed to be inequal.
///
/// At runtime this function behaves like `Some(self == other)`.
/// At runtime this function behaves like `Some(self != other)`.
/// However, in some contexts (e.g., compile-time evaluation),
/// it is not always possible to determine inequality of two pointers, so this function may
/// spuriously return `None` for pointers that later actually turn out to have its inequality known.
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sync/mpsc/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl<T> Packet<T> {
match self.queue.producer_addition().cnt.fetch_add(1, Ordering::SeqCst) {
// As described in the mod's doc comment, -1 == wakeup
-1 => UpWoke(self.take_to_wake()),
// As as described before, SPSC queues must be >= -2
// As described before, SPSC queues must be >= -2
-2 => UpSuccess,

// Be sure to preserve the disconnected state, and the return value
Expand Down
16 changes: 10 additions & 6 deletions library/std/src/sys/unix/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ impl Thread {
unsafe {
// Available since glibc 2.12, musl 1.1.16, and uClibc 1.0.20.
let name = truncate_cstr(name, TASK_COMM_LEN);
libc::pthread_setname_np(libc::pthread_self(), name.as_ptr());
let res = libc::pthread_setname_np(libc::pthread_self(), name.as_ptr());
// We have no good way of propagating errors here, but in debug-builds let's check that this actually worked.
debug_assert_eq!(res, 0);
}
}

Expand All @@ -152,19 +154,22 @@ impl Thread {
pub fn set_name(name: &CStr) {
unsafe {
let name = truncate_cstr(name, libc::MAXTHREADNAMESIZE);
libc::pthread_setname_np(name.as_ptr());
let res = libc::pthread_setname_np(name.as_ptr());
// We have no good way of propagating errors here, but in debug-builds let's check that this actually worked.
debug_assert_eq!(res, 0);
}
}

#[cfg(target_os = "netbsd")]
pub fn set_name(name: &CStr) {
unsafe {
let cname = CStr::from_bytes_with_nul_unchecked(b"%s\0".as_slice());
libc::pthread_setname_np(
let res = libc::pthread_setname_np(
libc::pthread_self(),
cname.as_ptr(),
name.as_ptr() as *mut libc::c_void,
);
debug_assert_eq!(res, 0);
}
}

Expand All @@ -177,9 +182,8 @@ impl Thread {
}

if let Some(f) = pthread_setname_np.get() {
unsafe {
f(libc::pthread_self(), name.as_ptr());
}
let res = unsafe { f(libc::pthread_self(), name.as_ptr()) };
debug_assert_eq!(res, 0);
}
}

Expand Down
9 changes: 9 additions & 0 deletions src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1276,6 +1276,15 @@ fn notable_traits_decl(decl: &clean::FnDecl, cx: &Context<'_>) -> String {

if let Some((did, ty)) = decl.output.as_return().and_then(|t| Some((t.def_id(cx.cache())?, t)))
{
// Box has pass-through impls for Read, Write, Iterator, and Future when the
// boxed type implements one of those. We don't want to treat every Box return
// as being notably an Iterator (etc), though, so we exempt it. Pin has the same
// issue, with a pass-through impl for Future.
if Some(did) == cx.tcx().lang_items().owned_box()
|| Some(did) == cx.tcx().lang_items().pin_type()
{
return "".to_string();
}
if let Some(impls) = cx.cache().impls.get(&did) {
for i in impls {
let impl_ = i.inner_impl();
Expand Down
51 changes: 19 additions & 32 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -549,47 +549,38 @@ ul.block, .block li {
margin-bottom: 0px;
}

pre.example-line-numbers {
overflow: initial;
border: 1px solid;
padding: 13px 8px;
text-align: right;
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
}

.src-line-numbers {
text-align: right;
}
.rustdoc:not(.source) .example-wrap > pre:not(.example-line-numbers) {
width: 100%;
overflow-x: auto;
}

.rustdoc:not(.source) .example-wrap > pre.src-line-numbers {
width: auto;
overflow-x: visible;
}

.rustdoc .example-wrap > pre {
margin: 0;
flex-grow: 1;
overflow-x: auto;
}

.search-loading {
text-align: center;
}

.content > .example-wrap pre.src-line-numbers {
position: relative;
.rustdoc .example-wrap > pre.example-line-numbers,
.rustdoc .example-wrap > pre.src-line-numbers {
flex-grow: 0;
overflow: initial;
text-align: right;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}

.example-line-numbers {
border: 1px solid;
padding: 13px 8px;
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
}

.src-line-numbers span {
cursor: pointer;
}

.search-loading {
text-align: center;
}

.docblock-short {
overflow-wrap: break-word;
overflow-wrap: anywhere;
Expand Down Expand Up @@ -2033,10 +2024,6 @@ in storage.js
padding-bottom: 0;
}

.scraped-example:not(.expanded) .code-wrapper pre.src-line-numbers {
overflow-x: hidden;
}

.scraped-example .code-wrapper .prev {
position: absolute;
top: 0.25em;
Expand Down
38 changes: 38 additions & 0 deletions src/test/rustdoc/doc-notable_trait_box_is_not_an_iterator.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#![feature(doc_notable_trait)]
#![feature(lang_items)]
#![feature(no_core)]
#![no_core]
#[lang = "owned_box"]
pub struct Box<T>;

impl<T> Box<T> {
pub fn new(x: T) -> Box<T> {
Box
}
}

#[doc(notable_trait)]
pub trait FakeIterator {}

impl<I: FakeIterator> FakeIterator for Box<I> {}

#[lang = "pin"]
pub struct Pin<T>;

impl<T> Pin<T> {
pub fn new(x: T) -> Pin<T> {
Pin
}
}

impl<I: FakeIterator> FakeIterator for Pin<I> {}

// @!has doc_notable_trait_box_is_not_an_iterator/fn.foo.html '//*' 'Notable'
pub fn foo<T>(x: T) -> Box<T> {
Box::new(x)
}

// @!has doc_notable_trait_box_is_not_an_iterator/fn.bar.html '//*' 'Notable'
pub fn bar<T>(x: T) -> Pin<T> {
Pin::new(x)
}
6 changes: 4 additions & 2 deletions src/tools/rust-analyzer/.github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: publish
on:
workflow_dispatch: # We can add version input when 1.0 is released and scheduled releases are removed

# schedule:
# - cron: "0 0 * * *" # midnight UTC
# schedule:
# - cron: "0 0 * * *" # midnight UTC

push:
branches:
Expand Down Expand Up @@ -50,5 +50,7 @@ jobs:
cargo workspaces rename --from test-utils test_utils
cargo workspaces rename --from text-edit text_edit
cargo workspaces rename ra_ap_%n
# Remove library crates from the workspaces so we don't auto-publish them as well
sed -i 's/ "lib\/\*",//' ./Cargo.toml
find crates/rust-analyzer -type f -name '*.rs' -exec sed -i 's/rust_analyzer/ra_ap_rust_analyzer/g' {} +
cargo workspaces publish --yes --force '*' --exact --no-git-commit --allow-dirty --skip-published custom 0.0.$PATCH
Loading